Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,13 +11,14 @@ base_model = "meta-llama/Meta-Llama-3-8B-Instruct"
|
|
| 11 |
|
| 12 |
llama_model = transformers.AutoModelForCausalLM.from_pretrained(base_model)
|
| 13 |
|
|
|
|
|
|
|
| 14 |
pipeline = transformers.pipeline(
|
| 15 |
"text-generation",
|
| 16 |
-
model=
|
| 17 |
model_kwargs={"torch_dtype": torch.bfloat16},
|
| 18 |
device="cuda",
|
| 19 |
)
|
| 20 |
-
pipeline.model = PeftModel.from_pretrained(llama_model, model_id)
|
| 21 |
|
| 22 |
def chat_function(message, history, system_prompt, max_new_tokens, temperature):
|
| 23 |
messages = [{"role":"system","content":system_prompt},
|
|
|
|
| 11 |
|
| 12 |
llama_model = transformers.AutoModelForCausalLM.from_pretrained(base_model)
|
| 13 |
|
| 14 |
+
peft_model = PeftModel.from_pretrained(llama_model, model_id)
|
| 15 |
+
|
| 16 |
pipeline = transformers.pipeline(
|
| 17 |
"text-generation",
|
| 18 |
+
model=peft_model,
|
| 19 |
model_kwargs={"torch_dtype": torch.bfloat16},
|
| 20 |
device="cuda",
|
| 21 |
)
|
|
|
|
| 22 |
|
| 23 |
def chat_function(message, history, system_prompt, max_new_tokens, temperature):
|
| 24 |
messages = [{"role":"system","content":system_prompt},
|