Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,15 @@ hf_token = os.getenv("gpt2_token")
|
|
9 |
|
10 |
if not hf_token:
|
11 |
raise ValueError("Hugging Face token not found. Please set HF_TOKEN as an environment variable.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
# Load the text generation pipeline with your fine-tuned model
|
13 |
-
generator = pipeline('text-generation', model=
|
14 |
|
15 |
# Function to generate responses using the text generation model
|
16 |
def respond(message, chat_history):
|
|
|
9 |
|
10 |
if not hf_token:
|
11 |
raise ValueError("Hugging Face token not found. Please set HF_TOKEN as an environment variable.")
|
12 |
+
|
13 |
+
model = AutoModelForCausalLM.from_pretrained(
|
14 |
+
"isitcoding/gpt2_120_finetuned",
|
15 |
+
config="adapter_config.json", # Specify the custom config file
|
16 |
+
state_dict="adapter_model.safetensors" # Specify the custom model weights
|
17 |
+
)
|
18 |
+
tokenizer = AutoTokenizer.from_pretrained("isitcoding/gpt2_120_finetuned")
|
19 |
# Load the text generation pipeline with your fine-tuned model
|
20 |
+
generator = pipeline('text-generation', model=model, tokenizer=tokenizer, use_auth_token = hf_token)
|
21 |
|
22 |
# Function to generate responses using the text generation model
|
23 |
def respond(message, chat_history):
|