Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -40,26 +40,26 @@ from demo_utils.constant import ZERO_VAE_CACHE
|
|
40 |
from demo_utils.vae_block3 import VAEDecoderWrapper
|
41 |
from utils.wan_wrapper import WanDiffusionWrapper, WanTextEncoder
|
42 |
|
43 |
-
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
|
44 |
|
45 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
46 |
|
47 |
-
model_checkpoint = "
|
48 |
|
49 |
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
50 |
|
51 |
-
quantization_config = BitsAndBytesConfig(
|
52 |
-
load_in_4bit=True,
|
53 |
-
bnb_4bit_compute_dtype=torch.bfloat16,
|
54 |
-
bnb_4bit_quant_type="nf4",
|
55 |
-
bnb_4bit_use_double_quant=True,
|
56 |
-
)
|
57 |
|
58 |
model = AutoModelForCausalLM.from_pretrained(
|
59 |
model_checkpoint,
|
60 |
torch_dtype=torch.bfloat16,
|
61 |
attn_implementation="flash_attention_2",
|
62 |
-
quantization_config=quantization_config,
|
63 |
device_map="auto"
|
64 |
)
|
65 |
enhancer = pipeline(
|
@@ -85,6 +85,16 @@ Describe lighting and colors
|
|
85 |
Note any changes or sudden events
|
86 |
Do not exceed the 150 word limit!
|
87 |
Output the enhanced prompt only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
"""
|
89 |
|
90 |
@spaces.GPU
|
|
|
40 |
from demo_utils.vae_block3 import VAEDecoderWrapper
|
41 |
from utils.wan_wrapper import WanDiffusionWrapper, WanTextEncoder
|
42 |
|
43 |
+
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM #, BitsAndBytesConfig
|
44 |
|
45 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
46 |
|
47 |
+
model_checkpoint = "unsloth/Llama-3.2-3B-Instruct"
|
48 |
|
49 |
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
50 |
|
51 |
+
# quantization_config = BitsAndBytesConfig(
|
52 |
+
# load_in_4bit=True,
|
53 |
+
# bnb_4bit_compute_dtype=torch.bfloat16,
|
54 |
+
# bnb_4bit_quant_type="nf4",
|
55 |
+
# bnb_4bit_use_double_quant=True,
|
56 |
+
# )
|
57 |
|
58 |
model = AutoModelForCausalLM.from_pretrained(
|
59 |
model_checkpoint,
|
60 |
torch_dtype=torch.bfloat16,
|
61 |
attn_implementation="flash_attention_2",
|
62 |
+
#quantization_config=quantization_config,
|
63 |
device_map="auto"
|
64 |
)
|
65 |
enhancer = pipeline(
|
|
|
85 |
Note any changes or sudden events
|
86 |
Do not exceed the 150 word limit!
|
87 |
Output the enhanced prompt only.
|
88 |
+
|
89 |
+
Examples:
|
90 |
+
user prompt: A man drives a toyota car.
|
91 |
+
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.
|
92 |
+
|
93 |
+
user prompt: A young woman is sitting on a chair.
|
94 |
+
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.
|
95 |
+
|
96 |
+
user prompt: Aerial view of a city skyline.
|
97 |
+
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.
|
98 |
"""
|
99 |
|
100 |
@spaces.GPU
|