Spaces:
Runtime error
Runtime error
Update app.py
Browse files39 unmodified lines404142434445464748495051525354555657585960616263646519 unmodified lines85868788899039 unmodified linesfrom demo_utils.vae_block3 import VAEDecoderWrapperfrom utils.wan_wrapper import WanDiffusionWrapper, WanTextEncoderfrom transformers import pipeline, AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfigdevice = "cuda" if torch.cuda.is_available() else "cpu"model_checkpoint = "meta-llama/Meta-Llama-3-8B-Instruct"tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)quantization_config = BitsAndBytesConfig(load_in_4bit=True,bnb_4bit_compute_dtype=torch.bfloat16,bnb_4bit_quant_type="nf4",bnb_4bit_use_double_quant=True,)model = AutoModelForCausalLM.from_pretrained(model_checkpoint,torch_dtype=torch.bfloat16,attn_implementation="flash_attention_2",quantization_config=quantization_config,device_map="auto")enhancer = pipeline(19 unmodified linesNote any changes or sudden eventsDo not exceed the 150 word limit!Output the enhanced prompt only."""@spaces.GPU39 unmodified lines404142434445464748495051525354555657585960616263646519 unmodified lines85868788899091929394959697989910039 unmodified linesfrom demo_utils.vae_block3 import VAEDecoderWrapperfrom utils.wan_wrapper import WanDiffusionWrapper, WanTextEncoderfrom transformers import pipeline, AutoTokenizer, AutoModelForCausalLM #, BitsAndBytesConfigdevice = "cuda" if torch.cuda.is_available() else "cpu"model_checkpoint = "unsloth/Llama-3.2-3B-Instruct"tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)# quantization_config = BitsAndBytesConfig(# load_in_4bit=True,# bnb_4bit_compute_dtype=torch.bfloat16,# bnb_4bit_quant_type="nf4",# bnb_4bit_use_double_quant=True,# )model = AutoModelForCausalLM.from_pretrained(model_checkpoint,torch_dtype=torch.bfloat16,attn_implementation="flash_attention_2",#quantization_config=quantization_config,device_map="auto")enhancer = pipeline(19 unmodified linesNote any changes or sudden eventsDo not exceed the 150 word limit!Output the enhanced prompt only.Examples:user prompt: A man drives a toyota car.enhanced prompt: A person is driving a car on a two-lane road, holding the steering wheel with both hands. The person's hands are light-skinned and they are wearing a black long-sleeved shirt. The steering wheel has a Toyota logo in the center and black leather around it. The car's dashboard is visible, showing a speedometer, tachometer, and navigation screen. The road ahead is straight and there are trees and fields visible on either side. The camera is positioned inside the car, providing a view from the driver's perspective. The lighting is natural and overcast, with a slightly cool tone.user prompt: A young woman is sitting on a chair.enhanced prompt: A young woman with dark, curly hair and pale skin sits on a chair; she wears a dark, intricately patterned dress with a high collar and long, dark gloves that extend past her elbows; the scene is dimly lit, with light streaming in from a large window behind the characters.user prompt: Aerial view of a city skyline.enhanced prompt: The camera pans across a cityscape of tall buildings with a circular building in the center. The camera moves from left to right, showing the tops of the buildings and the circular building in the center. The buildings are various shades of gray and white, and the circular building has a green roof. The camera angle is high, looking down at the city. The lighting is bright, with the sun shining from the upper left, casting shadows from the buildings."""@spaces.GPU
app.py+19-9