Instructions to use ProCreations/Image-2.1-Calibrated-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ProCreations/Image-2.1-Calibrated-FP8 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ProCreations/Image-2.1-Calibrated-FP8", 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
- Local Apps Settings
- Draw Things
- DiffusionBee
Add native transparent PNG workflow and exact repeated-prompt encoder reuse with paired RGBA quality and timing evidence
371818e verified Download rgba/source/decode_trial.py from ProCreations/Image-2.1-Calibrated-FP8: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/ProCreations/Image-2.1-Calibrated-FP8/resolve/main/rgba/source/decode_trial.py
- Command line
-
hf download hf://ProCreations/Image-2.1-Calibrated-FP8/rgba/source/decode_trial.py
-
curl -L -o decode_trial.py https://huggingface.co/ProCreations/Image-2.1-Calibrated-FP8/resolve/main/rgba/source/decode_trial.py
1.47 kB
| import json,time,sys | |
| from pathlib import Path | |
| import torch | |
| ROOT=Path(__file__).parent;APP=ROOT.parent | |
| sys.path.insert(0,str(APP/'release')) | |
| from fp8_runtime import load_pipeline | |
| from acceleration import accelerate_pipeline | |
| from fast_decode import enable | |
| PROMPT='A small corgi puppy sitting upright, full body, soft detailed fur, isolated on a transparent background, no shadow, no text.' | |
| def main(): | |
| p=accelerate_pipeline(load_pipeline('/home/user/models/qwen-image-2.1-b3179ad',APP/'release/transformer')) | |
| records=[] | |
| def run(): | |
| torch.cuda.synchronize();start=time.perf_counter() | |
| out=p(prompt=PROMPT,width=1024,height=1024,num_inference_steps=40,generator=torch.Generator('cuda').manual_seed(71001),output_type='latent').images | |
| torch.cuda.synchronize();return time.perf_counter()-start,out.clone() | |
| for mode in ['baseline','metadata','graph']: | |
| if mode!='baseline':enable(p,graph=mode=='graph') | |
| warm,_=run(); times=[] | |
| for i in range(3): | |
| sec,y=run();times.append(sec) | |
| if mode=='baseline':ref=y | |
| print(mode,i,sec,flush=True) | |
| row={'mode':mode,'warmup_seconds':warm,'times':times,'latent_equal':torch.equal(y,ref),'latent_nrmse':((y.float()-ref.float()).square().mean()/ref.float().square().mean()).sqrt().item()} | |
| records.append(row);(ROOT/'decode-trial.json').write_text(json.dumps(records,indent=2));print(row,flush=True) | |
| main() | |