krisha06 commited on
Commit
e299194
·
verified ·
1 Parent(s): f8eaabf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -10,13 +10,16 @@ tokenizer = AutoTokenizer.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0")
10
 
11
  # Load base model
12
  base_model = AutoModelForCausalLM.from_pretrained(
13
- "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
14
- device_map="auto",
15
- torch_dtype=torch.float32
16
  )
17
 
18
  # Load LoRA adapter
19
- model = PeftModel.from_pretrained(base_model, "lora_adapter", device_map="auto")
 
 
 
 
20
 
21
  # Load pipeline
22
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
 
10
 
11
  # Load base model
12
  base_model = AutoModelForCausalLM.from_pretrained(
13
+ "TinyLLaMA/TinyLLaMA-1.1B-Chat-v1.0", # or your exact model name
14
+ device_map="auto"
 
15
  )
16
 
17
  # Load LoRA adapter
18
+ model = PeftModel.from_pretrained(
19
+ base_model,
20
+ "lora_adapter", # folder name
21
+ device_map="auto"
22
+ )
23
 
24
  # Load pipeline
25
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)