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

Revert "[vicuna] Add streaming of tokens" #1588

Merged
merged 1 commit into from
Jun 23, 2023
Merged
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
3 changes: 0 additions & 3 deletions apps/language_models/src/pipelines/vicuna_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ def generate(self, prompt, cli=False):
logits = generated_token_op["logits"]
pkv = generated_token_op["pkv"]
detok = generated_token_op["detok"]
yield detok

res.append(detok)
res_tokens.append(token)
Expand Down Expand Up @@ -506,8 +505,6 @@ def generate(self, prompt, cli=False):
res.append(detok)
if cli:
print(f"{detok}", end=" ", flush=True)
yield detok

if self.device == "cuda":
del sec_vic, pkv, logits
torch.cuda.empty_cache()
Expand Down
8 changes: 5 additions & 3 deletions apps/stable_diffusion/web/ui/stablelm_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ def chat(curr_system_message, history, model, device, precision):
)
prompt = messages.strip()
print("prompt = ", prompt)
sentence = vicuna_model.generate(prompt)

partial_text = ""
for new_text in vicuna_model.generate(prompt):
for new_text in sentence.split(" "):
# print(new_text)
partial_text += new_text + " "
history[-1][1] = partial_text
# Yield an empty string to cleanup the message textbox and the updated conversation history
yield history
history[-1][1] = sentence
return history

# else Model is StableLM
Expand Down Expand Up @@ -122,13 +124,13 @@ def chat(curr_system_message, history, model, device, precision):
"TheBloke/vicuna-7B-1.1-HF",
],
)
supported_devices = available_devices + ["AMD-AIE"]
supported_devices = available_devices
enabled = len(supported_devices) > 0
device = gr.Dropdown(
label="Device",
value=supported_devices[0]
if enabled
else "No devices supported for now",
else "Only CUDA Supported for now",
choices=supported_devices,
interactive=enabled,
)
Expand Down
Loading