Update app.py
Browse files
app.py
CHANGED
@@ -16,17 +16,15 @@ peft_model_id = "phearion/bigbrain-v0.0.1"
|
|
16 |
config = PeftConfig.from_pretrained(peft_model_id)
|
17 |
model = AutoModelForCausalLM.from_pretrained(
|
18 |
config.base_model_name_or_path,
|
19 |
-
low_cpu_mem_usage=True,
|
20 |
-
return_dict=True,
|
21 |
torch_dtype=torch.bfloat16)
|
22 |
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
23 |
|
24 |
# Load the Lora model
|
25 |
model = PeftModel.from_pretrained(model, peft_model_id)
|
26 |
-
model = model.merge_and_unload()
|
27 |
|
28 |
def greet(text):
|
29 |
-
batch = tokenizer(f"\"{text
|
|
|
30 |
|
31 |
# Use torch.no_grad to disable gradient calculation
|
32 |
with torch.no_grad():
|
|
|
16 |
config = PeftConfig.from_pretrained(peft_model_id)
|
17 |
model = AutoModelForCausalLM.from_pretrained(
|
18 |
config.base_model_name_or_path,
|
|
|
|
|
19 |
torch_dtype=torch.bfloat16)
|
20 |
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
21 |
|
22 |
# Load the Lora model
|
23 |
model = PeftModel.from_pretrained(model, peft_model_id)
|
|
|
24 |
|
25 |
def greet(text):
|
26 |
+
batch = tokenizer(f"\"{text
|
27 |
+
}\" ->: ", return_tensors='pt')
|
28 |
|
29 |
# Use torch.no_grad to disable gradient calculation
|
30 |
with torch.no_grad():
|