Skip to content

Commit

Permalink
feat: add pushing the model to hf
Browse files Browse the repository at this point in the history
  • Loading branch information
alaeddine-13 committed Aug 25, 2023
1 parent 693deb2 commit 09d2811
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions textbook/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def train(
wandb_log_model: Optional[
bool
] = None, # will be true by default if use_wandb is true
push_model_to_hf: bool = False, # if set, will push the model to hf
local_rank: Annotated[int, typer.Option("--local_rank")] = 0,
deepspeed: Optional[str] = None,
debug: bool = False,
Expand Down Expand Up @@ -127,12 +128,13 @@ def train(

trainer.train()

model.save_pretrained("jinaai/starcoder-1b-textbook")
tokenizer.save_pretrained("jinaai/starcoder-1b-textbook")
if push_model_to_hf:
model.save_pretrained(output_dir)
tokenizer.save_pretrained(output_dir)

# Push to the hub
model.push_to_hub("jinaai/starcoder-1b-textbook")
tokenizer.push_to_hub("jinaai/starcoder-1b-textbook")
# Push to the hub
model.push_to_hub('jinaai/starcoder-1b-textbook')
tokenizer.push_to_hub('jinaai/starcoder-1b-textbook')

accuracy_results, sample_results = evaluate(
model, tokenizer, eval_size=eval_size, max_new_tokens=eval_max_new_tokens
Expand Down

0 comments on commit 09d2811

Please sign in to comment.