FilesLast commitLast update
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
README

Adapted Models

This folder stores reusable artifacts for models already adapted on Ascend 910C.

Each model uses:

{MODEL_NAME}/
  migration/           # baseline uv env, inference script, speed test, migration reports
  optimization/        # optimized inference, benchmark, torch_npu patches, optimization reports
  generation_quality/  # MSCOCO generation script, IS/FID score logs and summaries

Shared evaluation utilities are in:

ref_code/
eval_env/
reports/

Included Models

  • CogView4-6B
  • FLUX.1-dev
  • FLUX.2-dev
  • FLUX.2-klein-9B
  • GLM-Image
  • LongCat-Image
  • Qwen-Image
  • Z-Image
  • stable-diffusion-3.5-large

Running Baseline Inference

cd adapted_models/{MODEL_NAME}/migration
source /usr/local/Ascend/ascend-toolkit/set_env.sh
uv run python infer_npu.py --model-path /mnt/model/image_model/{MODEL_NAME}

Some copied scripts use model-specific filenames, for example flux1_npu_inference.py.

Running Speed Benchmarks

cd adapted_models/{MODEL_NAME}/migration
source /usr/local/Ascend/ascend-toolkit/set_env.sh
uv run python benchmark.py

Speed benchmarks should print and save the NPU type, for example the value from torch.npu.get_device_properties(0).name. The benchmark settings should follow the model's Hugging Face or official diffusers recommendation for steps, scheduler, resolution, and guidance scale.

For optimized A/B testing:

cd adapted_models/{MODEL_NAME}/optimization
source /usr/local/Ascend/ascend-toolkit/set_env.sh
uv run python benchmark_optimized.py

Running Generation Quality Scripts

cd adapted_models/{MODEL_NAME}/generation_quality
source /usr/local/Ascend/ascend-toolkit/set_env.sh
uv run python run_{MODEL_NAME}_npu_coco_generation.py

Generation-quality scripts should use the recommended Hugging Face or official diffusers setup. For non-step-distilled models, use about 50 inference steps as the quality baseline unless the model card recommends another value. For step-distilled models, use the official few-step setting.

Quality metrics use shared code:

TORCH_DEVICE_BACKEND_AUTOLOAD=0 UV_LINK_MODE=copy \
uv run python ../../ref_code/compute_is_score.py \
  --image_dir /mnt/model/image_model/evaluation/{MODEL_NAME}/mscoco_5k

Generated image datasets are runtime artifacts and are not stored here.