Views
No views yet
k4s4, {"scene_id":34,"characters":[{"character_id":"Unknown122","action":"speakingwithagesture","emotion":"concerned","position":"top-right","appearance":"darkhairtiedback,mustacheandgoatee,wearingaredrobewithyellowaccentsandadecorativehat"},{"character_id":"Unknown121","action":"listening","emotion":"focused","position":"bottom-center","appearance":"brownhairtiedup,wearingagreenrobewithacollar"}],"dialogue":[{"character_id":"Unknown122","dialogue_type":"exclamation","original_text":"하면...!","translated_text":"Then...!","position":"top-left"},{"character_id":"Unknown121","dialogue_type":"normalspeech","original_text":"하면대체이게무슨병이란말입니까!","translated_text":"Thenwhatillnessarewedealingwith?","position":"bottom-center"}],"description":"Unknown122,appearinganimatedandconcerned,questionsthenatureoftheillness,whileUnknown121listensintently,standingcloseinaninteriorroom.","setting":{"location":"interiorroomwithlatticewindows","time_of_the_day":"n/a"},"purpose_of_the_scene":"Toportraytheurgentsearchforananswertothemysteriousillnesstroublingthecharacters,addingintensitytothedilemma.","camera_angle":"high-angleshotcapturingbothcharacters","continuity_note":"MaintainUnknown122'sconcerneddemeanorandattire,consistentwithhispreviousscenes.","focal_points":["Unknown122'sanimatedexpression","dialoguebubbles"]}7.50.030FlowMatchEulerDiscreteScheduler42512x5121import torch
2from diffusers import DiffusionPipeline
3
4model_id = 'stabilityai/stable-diffusion-3.5-large'
5adapter_id = 'gunchoi/simpletuner-lora'
6pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
7pipeline.load_lora_weights(adapter_id)
8
9prompt = "k4s4, {"scene_id":34,"characters":[{"character_id":"Unknown122","action":"speakingwithagesture","emotion":"concerned","position":"top-right","appearance":"darkhairtiedback,mustacheandgoatee,wearingaredrobewithyellowaccentsandadecorativehat"},{"character_id":"Unknown121","action":"listening","emotion":"focused","position":"bottom-center","appearance":"brownhairtiedup,wearingagreenrobewithacollar"}],"dialogue":[{"character_id":"Unknown122","dialogue_type":"exclamation","original_text":"하면...!","translated_text":"Then...!","position":"top-left"},{"character_id":"Unknown121","dialogue_type":"normalspeech","original_text":"하면대체이게무슨병이란말입니까!","translated_text":"Thenwhatillnessarewedealingwith?","position":"bottom-center"}],"description":"Unknown122,appearinganimatedandconcerned,questionsthenatureoftheillness,whileUnknown121listensintently,standingcloseinaninteriorroom.","setting":{"location":"interiorroomwithlatticewindows","time_of_the_day":"n/a"},"purpose_of_the_scene":"Toportraytheurgentsearchforananswertothemysteriousillnesstroublingthecharacters,addingintensitytothedilemma.","camera_angle":"high-angleshotcapturingbothcharacters","continuity_note":"MaintainUnknown122'sconcerneddemeanorandattire,consistentwithhispreviousscenes.","focal_points":["Unknown122'sanimatedexpression","dialoguebubbles"]}"
10negative_prompt = 'blurry, cropped, ugly'
11
12## Optional: quantise the model to save on vram.
13## Note: The model was not quantised during training, so it is not necessary to quantise it during inference time.
14#from optimum.quanto import quantize, freeze, qint8
15#quantize(pipeline.transformer, weights=qint8)
16#freeze(pipeline.transformer)
17
18pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu') # the pipeline is already in its target precision level
19image = pipeline(
20 prompt=prompt,
21 negative_prompt=negative_prompt,
22 num_inference_steps=30,
23 generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
24 width=512,
25 height=512,
26 guidance_scale=7.5,
27).images[0]
28image.save("output.png", format="PNG")