Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,15 +3,16 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
3 |
import gradio as gr
|
4 |
|
5 |
# Adjust this to your model ID
|
6 |
-
model_id = "
|
7 |
-
|
|
|
8 |
# Load model with device map and dtype
|
9 |
model = AutoModelForCausalLM.from_pretrained(
|
10 |
model_id,
|
11 |
torch_dtype=torch.bfloat16,
|
12 |
device_map="auto"
|
13 |
)
|
14 |
-
|
15 |
|
16 |
# Load tokenizer and set truncation and padding
|
17 |
tokenizer = AutoTokenizer.from_pretrained(model_id, truncation=True, padding=True)
|
@@ -60,4 +61,4 @@ def generate_response(messages):
|
|
60 |
iface = gr.Interface(fn=generate_response, inputs="json", outputs="text", title="Meta-Llama-3-8B-Instruct")
|
61 |
|
62 |
# Launch the interface
|
63 |
-
iface.launch()
|
|
|
3 |
import gradio as gr
|
4 |
|
5 |
# Adjust this to your model ID
|
6 |
+
model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
|
7 |
+
|
8 |
+
peft_model_id = "decision-oaif/Meta-Llama-3-8B-Instruct-sft-intercode-bash-iter0"
|
9 |
# Load model with device map and dtype
|
10 |
model = AutoModelForCausalLM.from_pretrained(
|
11 |
model_id,
|
12 |
torch_dtype=torch.bfloat16,
|
13 |
device_map="auto"
|
14 |
)
|
15 |
+
model.load_adapter(peft_model_id)
|
16 |
|
17 |
# Load tokenizer and set truncation and padding
|
18 |
tokenizer = AutoTokenizer.from_pretrained(model_id, truncation=True, padding=True)
|
|
|
61 |
iface = gr.Interface(fn=generate_response, inputs="json", outputs="text", title="Meta-Llama-3-8B-Instruct")
|
62 |
|
63 |
# Launch the interface
|
64 |
+
iface.launch()
|