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

Implement download subcommand, optional positional model name argument #234

Merged
merged 14 commits into from
Apr 19, 2024
6 changes: 4 additions & 2 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ class GeneratorArgs:
def from_args(cls, args): # -> GeneratorArgs:
return cls(
prompt=args.prompt,
<<<<<<< HEAD
encoded_prompt=None,
chat_mode=args.chat,
=======
chat_mode=hasattr(args, "subcommand") and args.subcommand == "chat",
>>>>>>> 0dc48b0 (Merge GenerateArgs changes)
gui_mode=args.gui,
num_samples=args.num_samples,
max_new_tokens=args.max_new_tokens,
Expand Down Expand Up @@ -546,8 +550,6 @@ def callback(x):


def main(args):
is_chat = args.subcommand == "chat"

# If a named model was provided and not downloaded, download it.
if args.model and not is_model_downloaded(args.model, args.model_directory):
Copy link
Contributor

Choose a reason for hiding this comment

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

you should intercept this in a central place, like in cli() because all functions basically need to do the same? So we dupe it in a gazillion places?

download_and_convert(args.model, args.model_directory, args.hf_token)
Expand Down