Update app.py
Browse files
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
|
5 |
from transformers import AutoModelForCausalLM, AutoTokenizer, Seq2SeqTrainer, Seq2SeqTrainingArguments, pipeline
|
6 |
|
7 |
ACTION_1 = "Prompt base model"
|
@@ -116,15 +116,14 @@ def fine_tune_model(base_model_name, dataset_name):
|
|
116 |
|
117 |
# Save model to HF
|
118 |
|
119 |
-
|
120 |
-
|
|
|
121 |
repo_id=FT_MODEL_NAME,
|
122 |
repo_type="model",
|
123 |
use_auth_token=True,
|
124 |
)
|
125 |
|
126 |
-
repo.push_to_hub()
|
127 |
-
|
128 |
def prompt_model(model_name, system_prompt, user_prompt, sql_context):
|
129 |
pipe = pipeline("text-generation",
|
130 |
model=model_name,
|
|
|
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"
|
|
|
116 |
|
117 |
# Save model to HF
|
118 |
|
119 |
+
api = HfApi()
|
120 |
+
api.upload_file(
|
121 |
+
path_or_file="./output",
|
122 |
repo_id=FT_MODEL_NAME,
|
123 |
repo_type="model",
|
124 |
use_auth_token=True,
|
125 |
)
|
126 |
|
|
|
|
|
127 |
def prompt_model(model_name, system_prompt, user_prompt, sql_context):
|
128 |
pipe = pipeline("text-generation",
|
129 |
model=model_name,
|