sc2582 commited on
Commit
5a075e9
·
verified ·
1 Parent(s): 591016c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
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 = "decision-oaif/Meta-Llama-3-8B-Instruct-sft-alfworld-iter1"
7
- #peft_model_id = "decision-oaif/Meta-Llama-3-8B-Instruct-sft-intercode-python-iter0"
 
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
- #model.load_adapter(peft_model_id)
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()