Instructions to use yitongl/sparse_quant_exp with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use yitongl/sparse_quant_exp with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("yitongl/sparse_quant_exp", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Replace sfp4 checkpoint-750 with checkpoint-700
Browse files
README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
-
# sfp4_v4_sparse09_hpo_on_ours_p_init2050 checkpoint-
|
| 2 |
|
| 3 |
This upload contains the consolidated WanTransformer3DModel transformer weights
|
| 4 |
from:
|
| 5 |
|
| 6 |
-
`checkpoints/sfp4_v4_sparse09_hpo_on_ours_p_init2050_1n_interactive/checkpoint-
|
| 7 |
|
| 8 |
Contents:
|
| 9 |
|
|
@@ -30,7 +30,7 @@ SFT launch scripts.
|
|
| 30 |
|
| 31 |
It also includes the inference entrypoint snapshot and an example script:
|
| 32 |
|
| 33 |
-
- `backend_snapshot/scripts/inference/
|
| 34 |
- `backend_snapshot/training_attention_settings.json`
|
| 35 |
|
| 36 |
Attention setup for this checkpoint:
|
|
|
|
| 1 |
+
# sfp4_v4_sparse09_hpo_on_ours_p_init2050 checkpoint-700
|
| 2 |
|
| 3 |
This upload contains the consolidated WanTransformer3DModel transformer weights
|
| 4 |
from:
|
| 5 |
|
| 6 |
+
`checkpoints/sfp4_v4_sparse09_hpo_on_ours_p_init2050_1n_interactive/checkpoint-700`
|
| 7 |
|
| 8 |
Contents:
|
| 9 |
|
|
|
|
| 30 |
|
| 31 |
It also includes the inference entrypoint snapshot and an example script:
|
| 32 |
|
| 33 |
+
- `backend_snapshot/scripts/inference/run_sfp4_ours_p_checkpoint_700.sh`
|
| 34 |
- `backend_snapshot/training_attention_settings.json`
|
| 35 |
|
| 36 |
Attention setup for this checkpoint:
|
backend_snapshot/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
-
# Backend snapshot for checkpoint-
|
| 2 |
|
| 3 |
This directory is the code snapshot for the training backend used by:
|
| 4 |
|
| 5 |
-
`sfp4_v4_sparse09_hpo_on_ours_p_init2050_1n_interactive/checkpoint-
|
| 6 |
|
| 7 |
Key runtime settings:
|
| 8 |
|
|
@@ -38,7 +38,7 @@ Important files:
|
|
| 38 |
- `scripts/training/run_sparse_fp4_train_v4_common.sh`: common SFT launch/resume script.
|
| 39 |
- `training_attention_settings.json`: structured attention/training settings
|
| 40 |
for this checkpoint.
|
| 41 |
-
- `scripts/inference/
|
| 42 |
for the uploaded transformer checkpoint.
|
| 43 |
- `fastvideo/entrypoints/cli/generate.py`, `fastvideo/entrypoints/video_generator.py`,
|
| 44 |
`fastvideo/pipelines/basic/wan/wan_pipeline.py`, and
|
|
@@ -53,7 +53,7 @@ hf download yitongl/sparse_quant_exp \
|
|
| 53 |
--local-dir checkpoints/hf_download/sparse_quant_exp \
|
| 54 |
--include 'transformer/*'
|
| 55 |
|
| 56 |
-
bash backend_snapshot/scripts/inference/
|
| 57 |
```
|
| 58 |
|
| 59 |
Source repo HEAD when staged:
|
|
|
|
| 1 |
+
# Backend snapshot for checkpoint-700
|
| 2 |
|
| 3 |
This directory is the code snapshot for the training backend used by:
|
| 4 |
|
| 5 |
+
`sfp4_v4_sparse09_hpo_on_ours_p_init2050_1n_interactive/checkpoint-700`
|
| 6 |
|
| 7 |
Key runtime settings:
|
| 8 |
|
|
|
|
| 38 |
- `scripts/training/run_sparse_fp4_train_v4_common.sh`: common SFT launch/resume script.
|
| 39 |
- `training_attention_settings.json`: structured attention/training settings
|
| 40 |
for this checkpoint.
|
| 41 |
+
- `scripts/inference/run_sfp4_ours_p_checkpoint_700.sh`: inference example
|
| 42 |
for the uploaded transformer checkpoint.
|
| 43 |
- `fastvideo/entrypoints/cli/generate.py`, `fastvideo/entrypoints/video_generator.py`,
|
| 44 |
`fastvideo/pipelines/basic/wan/wan_pipeline.py`, and
|
|
|
|
| 53 |
--local-dir checkpoints/hf_download/sparse_quant_exp \
|
| 54 |
--include 'transformer/*'
|
| 55 |
|
| 56 |
+
bash backend_snapshot/scripts/inference/run_sfp4_ours_p_checkpoint_700.sh
|
| 57 |
```
|
| 58 |
|
| 59 |
Source repo HEAD when staged:
|
backend_snapshot/manifest.sha256
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
9c7dec8f1b8160954d0566231b0952a5f6a5d81f546affd71d190b2b3fc79cb6 ./examples/inference/basic/basic.py
|
| 3 |
9d1d8dc58aab529270fe31eb1735d6a1382c0c6d36fccca122a8dbffa1b714fd ./fastvideo-kernel/python/fastvideo_kernel/block_sparse_attn_ours_p.py
|
| 4 |
211c7f0445fbe9488250f01fa83457c6620e83bd6f3877db791fd155de93c08b ./fastvideo-kernel/python/fastvideo_kernel/triton_kernels/block_sparse_attn_triton_ours_p.py
|
|
@@ -25,9 +25,9 @@ c046b1914041b59254bcdfe577aed20d6f007a72632ea1fe1ae92fa678eca760 ./fastvideo/pl
|
|
| 25 |
2456d39ca28019e12bb7ab007774e86348f0582a017bf0e6c91e2a01d654a1a0 ./fastvideo/train/models/wan/wan.py
|
| 26 |
bc46e84b732567de6c0325223405daecd1226c623e303be33c7be9b5b7fdec08 ./fastvideo/training/training_pipeline.py
|
| 27 |
1d3898fa37e21029df6c37e05dc34ed7805a211c2f87de6642db890e5a8c6f2e ./fastvideo/training/wan_training_pipeline.py
|
| 28 |
-
|
| 29 |
0162b26dddb2a249e4e2cc56a7a28eba4fb3ea77e938eaf9c6b16a241edcd3ec ./scripts/inference/run_sfp4_single.sh
|
| 30 |
159579109f9fb7d7dded977f5c7fc974583c95f3f895e418d6c466463c036304 ./scripts/inference/run_validate_and_gen.sh
|
| 31 |
5c982b64653fae83ebfdeb43fda8f29b3e2cb581fb4daee38cd3cf56aa9d73f5 ./scripts/training/run_sparse_fp4_train_v4_1n_sparse09_hpo_on_ours_p_init2050_interactive.sh
|
| 32 |
5c1d5ce9ecc8b90e59ddfc2ddb3e2dae500bcd3acb90429c901444b1630f05fb ./scripts/training/run_sparse_fp4_train_v4_common.sh
|
| 33 |
-
|
|
|
|
| 1 |
+
936c4ab834574320b4cca77fe95ffea436c15c6e49b0ad4bd21d8ebf32701fc8 ./README.md
|
| 2 |
9c7dec8f1b8160954d0566231b0952a5f6a5d81f546affd71d190b2b3fc79cb6 ./examples/inference/basic/basic.py
|
| 3 |
9d1d8dc58aab529270fe31eb1735d6a1382c0c6d36fccca122a8dbffa1b714fd ./fastvideo-kernel/python/fastvideo_kernel/block_sparse_attn_ours_p.py
|
| 4 |
211c7f0445fbe9488250f01fa83457c6620e83bd6f3877db791fd155de93c08b ./fastvideo-kernel/python/fastvideo_kernel/triton_kernels/block_sparse_attn_triton_ours_p.py
|
|
|
|
| 25 |
2456d39ca28019e12bb7ab007774e86348f0582a017bf0e6c91e2a01d654a1a0 ./fastvideo/train/models/wan/wan.py
|
| 26 |
bc46e84b732567de6c0325223405daecd1226c623e303be33c7be9b5b7fdec08 ./fastvideo/training/training_pipeline.py
|
| 27 |
1d3898fa37e21029df6c37e05dc34ed7805a211c2f87de6642db890e5a8c6f2e ./fastvideo/training/wan_training_pipeline.py
|
| 28 |
+
9689cd17d841b713bb1627277e63bf436ac9a0a2f62f3f1ed7f9a6462c4def1a ./scripts/inference/run_sfp4_ours_p_checkpoint_700.sh
|
| 29 |
0162b26dddb2a249e4e2cc56a7a28eba4fb3ea77e938eaf9c6b16a241edcd3ec ./scripts/inference/run_sfp4_single.sh
|
| 30 |
159579109f9fb7d7dded977f5c7fc974583c95f3f895e418d6c466463c036304 ./scripts/inference/run_validate_and_gen.sh
|
| 31 |
5c982b64653fae83ebfdeb43fda8f29b3e2cb581fb4daee38cd3cf56aa9d73f5 ./scripts/training/run_sparse_fp4_train_v4_1n_sparse09_hpo_on_ours_p_init2050_interactive.sh
|
| 32 |
5c1d5ce9ecc8b90e59ddfc2ddb3e2dae500bcd3acb90429c901444b1630f05fb ./scripts/training/run_sparse_fp4_train_v4_common.sh
|
| 33 |
+
8ddeea65247d9fa31a4a8a2a5ce5abe068a911ff4d67871453555e1355af8ecf ./training_attention_settings.json
|
backend_snapshot/scripts/inference/run_sfp4_ours_p_checkpoint_700.sh
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
set -euo pipefail
|
| 4 |
+
|
| 5 |
+
REPO_ROOT="${REPO_ROOT:-/lustre/fsw/portfolios/nvr/projects/nvr_elm_llm/users/yitongl/code/FastVideo}"
|
| 6 |
+
MODEL_PATH="${MODEL_PATH:-Wan-AI/Wan2.1-T2V-1.3B-Diffusers}"
|
| 7 |
+
HF_REPO="${HF_REPO:-yitongl/sparse_quant_exp}"
|
| 8 |
+
CHECKPOINT_DIR="${CHECKPOINT_DIR:-${REPO_ROOT}/checkpoints/hf_download/sparse_quant_exp}"
|
| 9 |
+
WEIGHTS_PATH="${WEIGHTS_PATH:-${CHECKPOINT_DIR}/transformer/diffusion_pytorch_model.safetensors}"
|
| 10 |
+
OUTPUT_DIR="${OUTPUT_DIR:-${REPO_ROOT}/outputs/sfp4_v4_sparse09_checkpoint_700}"
|
| 11 |
+
PROMPT="${PROMPT:-A cinematic shot of a futuristic city street at dusk, reflective pavement, soft volumetric light, detailed motion, stable camera.}"
|
| 12 |
+
NEGATIVE_PROMPT="${NEGATIVE_PROMPT:-Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards}"
|
| 13 |
+
|
| 14 |
+
cd "${REPO_ROOT}"
|
| 15 |
+
|
| 16 |
+
if [[ -f ".venv/bin/activate" ]]; then
|
| 17 |
+
source .venv/bin/activate
|
| 18 |
+
fi
|
| 19 |
+
|
| 20 |
+
export PYTHONPATH="${REPO_ROOT}/fastvideo-kernel/python:${REPO_ROOT}/fastvideo-kernel:${PYTHONPATH:-}"
|
| 21 |
+
export FASTVIDEO_ATTENTION_BACKEND=SPARSE_FP4_OURS_P_ATTN
|
| 22 |
+
export FASTVIDEO_SPARSE_FP4_USE_HIGH_PREC_O=1
|
| 23 |
+
|
| 24 |
+
if [[ ! -f "${WEIGHTS_PATH}" ]]; then
|
| 25 |
+
echo "Missing ${WEIGHTS_PATH}"
|
| 26 |
+
echo "Download the uploaded transformer weights first:"
|
| 27 |
+
echo " hf download ${HF_REPO} --repo-type model --local-dir ${CHECKPOINT_DIR} --include 'transformer/*'"
|
| 28 |
+
exit 1
|
| 29 |
+
fi
|
| 30 |
+
|
| 31 |
+
mkdir -p "${OUTPUT_DIR}"
|
| 32 |
+
|
| 33 |
+
fastvideo generate \
|
| 34 |
+
--model-path "${MODEL_PATH}" \
|
| 35 |
+
--init-weights-from-safetensors "${WEIGHTS_PATH}" \
|
| 36 |
+
--sp-size 1 \
|
| 37 |
+
--tp-size 1 \
|
| 38 |
+
--num-gpus 1 \
|
| 39 |
+
--dit-cpu-offload False \
|
| 40 |
+
--vae-cpu-offload False \
|
| 41 |
+
--text-encoder-cpu-offload True \
|
| 42 |
+
--pin-cpu-memory False \
|
| 43 |
+
--height 448 \
|
| 44 |
+
--width 832 \
|
| 45 |
+
--num-frames 77 \
|
| 46 |
+
--num-inference-steps 50 \
|
| 47 |
+
--fps 16 \
|
| 48 |
+
--guidance-scale 5.0 \
|
| 49 |
+
--flow-shift 1.0 \
|
| 50 |
+
--prompt "${PROMPT}" \
|
| 51 |
+
--negative-prompt "${NEGATIVE_PROMPT}" \
|
| 52 |
+
--seed 1000 \
|
| 53 |
+
--VSA-sparsity 0.9 \
|
| 54 |
+
--output-path "${OUTPUT_DIR}/"
|
backend_snapshot/training_attention_settings.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"run_name": "sfp4_v4_sparse09_hpo_on_ours_p_init2050_1n_interactive",
|
| 3 |
-
"checkpoint": "checkpoint-
|
| 4 |
"training_method": "legacy_sft_wan_training_pipeline",
|
| 5 |
"model_path": "Wan-AI/Wan2.1-T2V-1.3B-Diffusers",
|
| 6 |
"init_weights_from_safetensors": "checkpoints/init/sfp4_v4_sparse06_hpo_on_ours_p_1n_interactive_v2_ckpt2050/transformer/diffusion_pytorch_model.safetensors",
|
|
|
|
| 1 |
{
|
| 2 |
"run_name": "sfp4_v4_sparse09_hpo_on_ours_p_init2050_1n_interactive",
|
| 3 |
+
"checkpoint": "checkpoint-700",
|
| 4 |
"training_method": "legacy_sft_wan_training_pipeline",
|
| 5 |
"model_path": "Wan-AI/Wan2.1-T2V-1.3B-Diffusers",
|
| 6 |
"init_weights_from_safetensors": "checkpoints/init/sfp4_v4_sparse06_hpo_on_ours_p_1n_interactive_v2_ckpt2050/transformer/diffusion_pytorch_model.safetensors",
|
transformer/diffusion_pytorch_model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5676070784
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4595ca81ea7085c15ccf14b738aa9c0fdf2d2786641f49b55e0bc0e99bf042d2
|
| 3 |
size 5676070784
|