Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ examples = [
|
|
37 |
]
|
38 |
|
39 |
MODEL_OPTIONS = {
|
40 |
-
"REALVISXL V5.0": "SG161222/RealVisXL_V5.0",
|
41 |
"REALVISXL V5.0 BF16": "ford442/RealVisXL_V5.0_BF16",
|
42 |
}
|
43 |
|
@@ -87,17 +87,17 @@ def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str
|
|
87 |
|
88 |
def load_and_prepare_model(model_id):
|
89 |
model_dtypes = {
|
90 |
-
"SG161222/RealVisXL_V5.0": torch.float32,
|
91 |
"ford442/RealVisXL_V5.0_BF16": torch.bfloat16,
|
92 |
}
|
93 |
|
94 |
# Get the dtype based on the model_id
|
95 |
-
dtype = model_dtypes.get(model_id, torch.
|
96 |
|
97 |
# Load the pipeline with the determined dtype
|
98 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
99 |
model_id,
|
100 |
-
torch_dtype=
|
101 |
use_safetensors=True,
|
102 |
add_watermarker=False,
|
103 |
).to(device)
|
@@ -357,19 +357,9 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
|
|
357 |
</div>
|
358 |
""")
|
359 |
|
360 |
-
tokenizer = AutoTokenizer.from_pretrained("HuggingFaceH4/zephyr-7b-beta")
|
361 |
-
model = AutoModelForCausalLM.from_pretrained("HuggingFaceH4/zephyr-7b-beta")
|
362 |
-
|
363 |
def text_generation(input_text, seed):
|
364 |
-
full_prompt =
|
365 |
-
|
366 |
-
Your scene:
|
367 |
-
"""
|
368 |
-
input_ids = tokenizer(full_prompt, return_tensors="pt").input_ids
|
369 |
-
torch.manual_seed(seed)
|
370 |
-
outputs = model.generate(input_ids, do_sample=True, min_length=100, max_length=300)
|
371 |
-
generated_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
372 |
-
return generated_text
|
373 |
|
374 |
title = "Text Generator Demo GPT-Neo"
|
375 |
description = "Text Generator Application by ecarbo"
|
|
|
37 |
]
|
38 |
|
39 |
MODEL_OPTIONS = {
|
40 |
+
# "REALVISXL V5.0": "SG161222/RealVisXL_V5.0",
|
41 |
"REALVISXL V5.0 BF16": "ford442/RealVisXL_V5.0_BF16",
|
42 |
}
|
43 |
|
|
|
87 |
|
88 |
def load_and_prepare_model(model_id):
|
89 |
model_dtypes = {
|
90 |
+
#"SG161222/RealVisXL_V5.0": torch.float32,
|
91 |
"ford442/RealVisXL_V5.0_BF16": torch.bfloat16,
|
92 |
}
|
93 |
|
94 |
# Get the dtype based on the model_id
|
95 |
+
dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
|
96 |
|
97 |
# Load the pipeline with the determined dtype
|
98 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
99 |
model_id,
|
100 |
+
torch_dtype=torch.bfloat16,
|
101 |
use_safetensors=True,
|
102 |
add_watermarker=False,
|
103 |
).to(device)
|
|
|
357 |
</div>
|
358 |
""")
|
359 |
|
|
|
|
|
|
|
360 |
def text_generation(input_text, seed):
|
361 |
+
full_prompt = "Text Generator Application by ecarbo"
|
362 |
+
return full_prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
|
364 |
title = "Text Generator Demo GPT-Neo"
|
365 |
description = "Text Generator Application by ecarbo"
|