Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move attention mask to device in web ui demo #70

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/requirements_web_demo.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
gradio==4.31.3
gradio==4.44.0
modelscope-studio
3 changes: 2 additions & 1 deletion demo/web_demo_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def predict(chatbot, task_history):
print(f"{audios=}")
inputs = processor(text=text, audios=audios, return_tensors="pt", padding=True)
if not _get_args().cpu_only:
inputs["input_ids"] = inputs.input_ids.to("cuda")
inputs["input_ids"] = inputs.input_ids.to(model.device)
inputs["attention_mask"] = inputs.attention_mask.to(model.device)

generate_ids = model.generate(**inputs, max_length=256)
generate_ids = generate_ids[:, inputs.input_ids.size(1):]
Expand Down