Views
No views yet
1hf download INCModel/NextStep-1.1-W4A16-AutoRound /workspace/models/stepfun-ai/NextStep-1.1-W4A16/
2export PYTHONPATH=/workspace/models/stepfun-ai/NextStep-1.1-W4A16/
3cd /workspace/models/stepfun-ai/NextStep-1.1-W4A16/
4uv pip install transformers==4.57.6
5uv pip install gptqmodel==5.8.0 --no-build-isolation
6python run_generation.py1# run_generation.py
2import torch
3from transformers import AutoTokenizer, AutoModel
4from models.gen_pipeline import NextStepPipeline
5
6HF_HUB = "INCModel/NextStep-1.1-W4A16-AutoRound"
7
8# load model and tokenizer
9tokenizer = AutoTokenizer.from_pretrained(HF_HUB, local_files_only=True, trust_remote_code=True)
10
11# set device_map="cuda" to leverage gptqmodel kernels
12model = AutoModel.from_pretrained(HF_HUB, local_files_only=True, trust_remote_code=True, device_map="cuda")
13print(model) # Ensure that MarlinQuantLinear() is loaded
14pipeline = NextStepPipeline(tokenizer=tokenizer, model=model).to(device="cuda", dtype=torch.bfloat16)
15
16# set prompts
17positive_prompt = ""
18negative_prompt = "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry."
19example_prompt = "A REALISTIC PHOTOGRAPH OF A WALL WITH \"TOWARD AUTOREGRESSIVE IMAGE GENERATION WITH CONTINUOUS TOKENS AT SCALE\" PROMINENTLY DISPLAYED"
20
21# generate image from text
22IMG_SIZE = 512
23image = pipeline.generate_image(
24 example_prompt,
25 hw=(IMG_SIZE, IMG_SIZE),
26 num_images_per_caption=1,
27 positive_prompt=positive_prompt,
28 negative_prompt=negative_prompt,
29 cfg=7.5,
30 cfg_img=1.0,
31 cfg_schedule="constant",
32 use_norm=False,
33 num_sampling_steps=28,
34 timesteps_shift=1.0,
35 seed=3407,
36)[0]
37image.save("./output.jpg")

1hf download stepfun-ai/NextStep-1.1 /workspace/models/stepfun-ai/NextStep-1.1
2export PYTHONPATH=/workspace/models/stepfun-ai/NextStep-1.1/
3cd /workspace/models/stepfun-ai/NextStep-1.1/
4auto-round /workspace/models/stepfun-ai/NextStep-1.1/ --output_dir "/workspace/models/stepfun-ai/NextStep-1.1-W4A16" --num_inference_steps 1