🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content
aden9460Public

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

EVAR: Edge Visual Autoregressive Models via Principled Pruning

Official codebase for the paper EVAR: Edge Visual Autoregressive Models via Principled Pruning (ECCV 2026).

EVAR combines:

  • Pyramid-Aware Optimal Brain Surgeon (OBS) for structured pruning of VAR models
  • Scale-aware distillation for post-pruning fine-tuning

Repository structure

.
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ models/                 # Shared VAR / VQVAE model definitions
β”œβ”€β”€ utils/                  # Shared training and data utilities
β”œβ”€β”€ prune/
β”‚   β”œβ”€β”€ prune.py            # Main Pyramid-Aware OBS pruning entrypoint
β”‚   β”œβ”€β”€ pruning.bash        # Example pruning launcher
β”‚   └── evar_utils/
β”‚       └── pyramid_aware_obs.py
└── train/
    β”œβ”€β”€ train.py            # Standard VAR fine-tuning / training entrypoint
    β”œβ”€β”€ trainer.py          # Core trainer
    β”œβ”€β”€ dist.py             # Distributed training helpers
    └── distill/
        β”œβ”€β”€ train_distill.py
        β”œβ”€β”€ distillation_trainer.py
        β”œβ”€β”€ distillation_losses.py
        β”œβ”€β”€ distill_utils.py
        β”œβ”€β”€ train_normal.bash
        β”œβ”€β”€ train_aware.bash
        └── README.md

Main components

1. Pyramid-Aware OBS pruning

The pruning pipeline is implemented in:

  • prune/prune.py
  • prune/evar_utils/pyramid_aware_obs.py

Core idea:

  • accumulate Hessian statistics over the VAR token pyramid,
  • normalize each scale by its token count,
  • upweight coarse scales to preserve global structure,
  • apply OBS-style analytical compensation during structured pruning.

2. Distillation and fine-tuning

The distillation pipeline is implemented in:

  • train/distill/train_distill.py
  • train/distill/distillation_trainer.py
  • train/distill/distillation_losses.py

Supported distillation modes:

  • normal
  • scale_aware
  • both

Installation

We recommend Python 3.10+ and CUDA-enabled PyTorch.

pip install -r requirements.txt

Depending on your environment, you may need to install a CUDA-matched PyTorch build manually.

Data and checkpoints

Before running pruning or training, prepare:

  • a pretrained VQ-VAE checkpoint
  • a pretrained VAR checkpoint or a pruned student checkpoint
  • ImageNet data (or your compatible dataset layout)

Most scripts expose these paths through command-line arguments such as:

  • --vae_path / --vae_ckpt
  • --var_path / --var_ckpt
  • --teacher_model_path
  • --data_path
  • --imagenet_dir

Pruning

Example:

cd prune
python prune.py \
  --model_depth 16 \
  --vae_ckpt /path/to/vae.pth \
  --var_ckpt /path/to/var.pth \
  --num_samples 5000 \
  --sparsity 0.4 \
  --use_images \
  --imagenet_dir /path/to/imagenet \
  --save_dir ./pruned_models \
  --model_name evar_d16_0.4_pyramid_obs.pth

Or use the provided launcher:

cd prune
bash pruning.bash

Fine-tuning without distillation

Example:

cd train
torchrun --nproc_per_node=8 train.py \
  --depth=16 \
  --bs=256 \
  --ep=40 \
  --fp16=1 \
  --var_path /path/to/pruned_student.pth \
  --vae_path /path/to/vae.pth \
  --data_path /path/to/imagenet \
  --local_out_dir_path /path/to/output

Distillation

Example scale-aware distillation:

cd train
torchrun --nproc_per_node=8 distill/train_distill.py \
  --enable_distillation=1 \
  --teacher_model_path /path/to/teacher.pth \
  --teacher_depth 16 \
  --distill_type scale_aware \
  --depth=16 \
  --bs=256 \
  --ep=40 \
  --fp16=1 \
  --var_path /path/to/pruned_student.pth \
  --vae_path /path/to/vae.pth \
  --data_path /path/to/imagenet \
  --local_out_dir_path /path/to/output

Performance Comparison (ImageNet 256Γ—256)

Model Parameters Pruning FID↓ IS↑ Precision↑ Recall↑
VAR-d16 310M - 3.55 274.4 0.84 0.51
EVAR (20%) 270M 20% 3.67 267.5 0.81 0.51
EVAR (40%) 230M 40% 3.91 259.1 0.81 0.51

Acknowledgements

This project builds upon and references the following excellent works:

  • VAR: Visual Autoregressive Modeling - Scalable Image Generation via Next-Scale Prediction
  • DepGraph: Towards Any Structural Pruning
  • Optimal Brain Compression: A Framework for Accurate Post-Training Quantization and Pruning
  • SlimGPT: Layer-wise Structured Pruning for Large Language Models

We extend our gratitude to the authors for their outstanding contributions to the community.

License

This project is released under the MIT License. See the LICENSE file for details.

Citation

If you use this code, please cite the EVAR paper:

@inproceedings{wang2026evar,
  title={EVAR: Edge Visual Autoregressive Models via Principled Pruning},
  author={Wang, Zefang and Li, Ying and Li, Yanyu and Su, Mingluo and Xu, Simin and Tian, Guanzhong and Wang, Huan},
  booktitle={ECCV},
  year={2026}
}

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages