Update src/pipeline.py
Browse files40 unmodified lines4142434445465 unmodified lines52535455565740 unmodified linesckpt_id = "black-forest-labs/FLUX.1-schnell"ckpt_revision = "741f7c3ce8b383c54771c7003378a50191e9efe9"def load_pipeline() -> Pipeline:text_encoder_2 = T5EncoderModel.from_pretrained("city96/t5-v1_1-xxl-encoder-bf16", revision = "1b9c856aadb864af93c1dcdc226c2774fa67bc86", torch_dtype=torch.bfloat16) # subfolder="text_encoder_2",# path = os.path.join(HF_HUB_CACHE, "models--manbeast3b--flux.1-schnell-full1/snapshots/cb1b599b0d712b9aab2c4df3ad27b050a27ec146/transformer")5 unmodified linesfor _ in range(1):pipeline(prompt="insensible, timbale, pothery, electrovital, actinogram, taxis, intracerebellar, centrodesmus", width=1024, height=1024, guidance_scale=0.0, num_inference_steps=4, max_sequence_length=256)return pipeline@torch.no_grad()def infer(request: TextToImageRequest, pipeline: Pipeline, generator: Generator) -> Image:40 unmodified lines414243444546475 unmodified lines5354555657585960616263646566676869707172737475767778798081828384858640 unmodified linesckpt_id = "black-forest-labs/FLUX.1-schnell"ckpt_revision = "741f7c3ce8b383c54771c7003378a50191e9efe9"'''def load_pipeline() -> Pipeline:text_encoder_2 = T5EncoderModel.from_pretrained("city96/t5-v1_1-xxl-encoder-bf16", revision = "1b9c856aadb864af93c1dcdc226c2774fa67bc86", torch_dtype=torch.bfloat16) # subfolder="text_encoder_2",# path = os.path.join(HF_HUB_CACHE, "models--manbeast3b--flux.1-schnell-full1/snapshots/cb1b599b0d712b9aab2c4df3ad27b050a27ec146/transformer")5 unmodified linesfor _ in range(1):pipeline(prompt="insensible, timbale, pothery, electrovital, actinogram, taxis, intracerebellar, centrodesmus", width=1024, height=1024, guidance_scale=0.0, num_inference_steps=4, max_sequence_length=256)return pipeline'''def load_pipeline() -> Pipeline:empty_cache()dtype, device = torch.bfloat16, "cuda"text_encoder_2 = T5EncoderModel.from_pretrained("city96/t5-v1_1-xxl-encoder-bf16", revision = "1b9c856aadb864af93c1dcdc226c2774fa67bc86", torch_dtype=torch.bfloat16).to(memory_format=torch.channels_last)path = os.path.join(HF_HUB_CACHE, "models--RobertML--FLUX.1-schnell-int8wo/snapshots/307e0777d92df966a3c0f99f31a6ee8957a9857a")model = FluxTransformer2DModel.from_pretrained(path, torch_dtype=dtype, use_safetensors=False).to(memory_format=torch.channels_last)pipeline = DiffusionPipeline.from_pretrained(ckpt_id,revision=ckpt_revision,transformer=model,text_encoder_2=text_encoder_2,torch_dtype=dtype,).to(device)#quantize_(pipeline.vae, int8_weight_only())pipeline(prompt="onomancy, aftergo, spirantic, Platyhelmia, modificator, drupaceous, jobbernowl, hereness", width=1024, height=1024, guidance_scale=0.0, num_inference_steps=4, max_sequence_length=256)empty_cache()return pipeline@torch.no_grad()def infer(request: TextToImageRequest, pipeline: Pipeline, generator: Generator) -> Image:
src/pipeline.py+29