Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
|
@@ -179,7 +179,8 @@ def generate_image(model_name: str, text: str, image: Image.Image,
|
|
| 179 |
prompt_full = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 180 |
inputs = processor(
|
| 181 |
text=[prompt_full], images=[image], return_tensors="pt", padding=True,
|
| 182 |
-
truncation=True,
|
|
|
|
| 183 |
).to(device)
|
| 184 |
streamer = TextIteratorStreamer(processor, skip_prompt=True, skip_special_tokens=True)
|
| 185 |
generation_kwargs = {**inputs, "streamer": streamer, "max_new_tokens": max_new_tokens}
|
|
|
|
| 179 |
prompt_full = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 180 |
inputs = processor(
|
| 181 |
text=[prompt_full], images=[image], return_tensors="pt", padding=True,
|
| 182 |
+
truncation=True,
|
| 183 |
+
max_length=MAX_INPUT_TOKEN_LENGTH
|
| 184 |
).to(device)
|
| 185 |
streamer = TextIteratorStreamer(processor, skip_prompt=True, skip_special_tokens=True)
|
| 186 |
generation_kwargs = {**inputs, "streamer": streamer, "max_new_tokens": max_new_tokens}
|