Spaces:
Runtime error
Runtime error
vaishakgkumar
commited on
Commit
·
ed92110
1
Parent(s):
474745c
Update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
52 |
|
53 |
# Use the base model's ID
|
54 |
base_model_id = "stabilityai/stablelm-3b-4e1t"
|
55 |
-
model_directory = "vaishakgkumar/
|
56 |
# Instantiate the Tokenizer
|
57 |
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-3b-4e1t", token=hf_token, trust_remote_code=True, padding_side="left")
|
58 |
# tokenizer = AutoTokenizer.from_pretrained("vaishakgkumar/stablemedv3", trust_remote_code=True, padding_side="left")
|
@@ -60,9 +60,9 @@ tokenizer.pad_token = tokenizer.eos_token
|
|
60 |
tokenizer.padding_side = 'left'
|
61 |
|
62 |
# Load the PEFT model
|
63 |
-
peft_config = PeftConfig.from_pretrained("vaishakgkumar/
|
64 |
peft_model = AutoModelForCausalLM.from_pretrained("stabilityai/stablelm-3b-4e1t", token=hf_token, trust_remote_code=True)
|
65 |
-
peft_model = PeftModel.from_pretrained(peft_model, "vaishakgkumar/
|
66 |
|
67 |
class ChatBot:
|
68 |
def __init__(self):
|
@@ -82,7 +82,7 @@ class ChatBot:
|
|
82 |
chat_history_ids = user_input_ids
|
83 |
|
84 |
# Generate a response using the PEFT model
|
85 |
-
response = peft_model.generate(input_ids=chat_history_ids, max_length=
|
86 |
|
87 |
# Update chat history
|
88 |
self.history = chat_history_ids
|
|
|
52 |
|
53 |
# Use the base model's ID
|
54 |
base_model_id = "stabilityai/stablelm-3b-4e1t"
|
55 |
+
model_directory = "vaishakgkumar/stablemedv1"
|
56 |
# Instantiate the Tokenizer
|
57 |
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-3b-4e1t", token=hf_token, trust_remote_code=True, padding_side="left")
|
58 |
# tokenizer = AutoTokenizer.from_pretrained("vaishakgkumar/stablemedv3", trust_remote_code=True, padding_side="left")
|
|
|
60 |
tokenizer.padding_side = 'left'
|
61 |
|
62 |
# Load the PEFT model
|
63 |
+
peft_config = PeftConfig.from_pretrained("vaishakgkumar/stablemedv1", token=hf_token)
|
64 |
peft_model = AutoModelForCausalLM.from_pretrained("stabilityai/stablelm-3b-4e1t", token=hf_token, trust_remote_code=True)
|
65 |
+
peft_model = PeftModel.from_pretrained(peft_model, "vaishakgkumar/stablemedv1", token=hf_token)
|
66 |
|
67 |
class ChatBot:
|
68 |
def __init__(self):
|
|
|
82 |
chat_history_ids = user_input_ids
|
83 |
|
84 |
# Generate a response using the PEFT model
|
85 |
+
response = peft_model.generate(input_ids=chat_history_ids, max_length=512, pad_token_id=tokenizer.eos_token_id)
|
86 |
|
87 |
# Update chat history
|
88 |
self.history = chat_history_ids
|