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

Use variables [generate_params and server_name] in generate.py #393

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 2 additions & 8 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,7 @@ def generate_with_streaming(**kwargs):

# Without streaming
with torch.no_grad():
generation_output = model.generate(
input_ids=input_ids,
generation_config=generation_config,
return_dict_in_generate=True,
output_scores=True,
max_new_tokens=max_new_tokens,
)
generation_output = model.generate(**generate_params)
s = generation_output.sequences[0]
output = tokenizer.decode(s)
yield prompter.get_response(output)
Expand Down Expand Up @@ -192,7 +186,7 @@ def generate_with_streaming(**kwargs):
],
title="🦙🌲 Alpaca-LoRA",
description="Alpaca-LoRA is a 7B-parameter LLaMA model finetuned to follow instructions. It is trained on the [Stanford Alpaca](https://github.com/tatsu-lab/stanford_alpaca) dataset and makes use of the Huggingface LLaMA implementation. For more information, please visit [the project's website](https://github.com/tloen/alpaca-lora).", # noqa: E501
).queue().launch(server_name="0.0.0.0", share=share_gradio)
).queue().launch(server_name=server_name, share=share_gradio)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
we can use the variable from the parameter

# Old testing code follows.

"""
Expand Down