bstraehle commited on
Commit
256580a
·
verified ·
1 Parent(s): 0db656a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  import os, torch
3
  from datasets import load_dataset
4
- from huggingface_hub import HfApi
5
  from transformers import AutoModelForCausalLM, AutoTokenizer, Seq2SeqTrainer, Seq2SeqTrainingArguments, pipeline
6
 
7
  ACTION_1 = "Prompt base model"
@@ -114,15 +114,18 @@ def fine_tune_model(base_model_name, dataset_name):
114
 
115
  #trainer.train()
116
 
117
- # Save model to HF
118
 
119
- api = HfApi()
120
 
 
 
121
  api.upload_folder(
122
  folder_path="./output",
123
- repo_id=FT_MODEL_NAME,
124
- repo_type="model",
125
  )
 
 
126
 
127
  def prompt_model(model_name, system_prompt, user_prompt, sql_context):
128
  pipe = pipeline("text-generation",
 
1
  import gradio as gr
2
  import os, torch
3
  from datasets import load_dataset
4
+ from huggingface_hub import HfApi, login
5
  from transformers import AutoModelForCausalLM, AutoTokenizer, Seq2SeqTrainer, Seq2SeqTrainingArguments, pipeline
6
 
7
  ACTION_1 = "Prompt base model"
 
114
 
115
  #trainer.train()
116
 
117
+ # Save model and tokenizer to HF
118
 
119
+ login(token=os.environ["HF_TOKEN"])
120
 
121
+ api = HfApi()
122
+ api.create_repo(repo_id=FT_MODEL_NAME)
123
  api.upload_folder(
124
  folder_path="./output",
125
+ repo_id="Meta-Llama-3.1-8B-Instruct-text-to-sql"
 
126
  )
127
+
128
+ tokenizer.push_to_hub(FT_MODEL_NAME)
129
 
130
  def prompt_model(model_name, system_prompt, user_prompt, sql_context):
131
  pipe = pipeline("text-generation",