Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
|
@@ -116,7 +116,7 @@ css = """
|
|
| 116 |
"""
|
| 117 |
|
| 118 |
MAX_MAX_NEW_TOKENS = 4096
|
| 119 |
-
DEFAULT_MAX_NEW_TOKENS =
|
| 120 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
| 121 |
|
| 122 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
@@ -287,9 +287,7 @@ def generate_video(model_name: str, text: str, video_path: str,
|
|
| 287 |
|
| 288 |
prompt_full = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 289 |
inputs = processor(
|
| 290 |
-
text=[prompt_full], images=images_for_processor, return_tensors="pt", padding=True
|
| 291 |
-
truncation=True, max_length=MAX_INPUT_TOKEN_LENGTH
|
| 292 |
-
).to(device)
|
| 293 |
streamer = TextIteratorStreamer(processor, skip_prompt=True, skip_special_tokens=True)
|
| 294 |
generation_kwargs = {
|
| 295 |
**inputs, "streamer": streamer, "max_new_tokens": max_new_tokens,
|
|
|
|
| 116 |
"""
|
| 117 |
|
| 118 |
MAX_MAX_NEW_TOKENS = 4096
|
| 119 |
+
DEFAULT_MAX_NEW_TOKENS = 1024
|
| 120 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
| 121 |
|
| 122 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
|
| 287 |
|
| 288 |
prompt_full = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 289 |
inputs = processor(
|
| 290 |
+
text=[prompt_full], images=images_for_processor, return_tensors="pt", padding=True).to(device)
|
|
|
|
|
|
|
| 291 |
streamer = TextIteratorStreamer(processor, skip_prompt=True, skip_special_tokens=True)
|
| 292 |
generation_kwargs = {
|
| 293 |
**inputs, "streamer": streamer, "max_new_tokens": max_new_tokens,
|