Spaces:
No application file
No application file
Yaswanth sai
commited on
Commit
·
19a006f
1
Parent(s):
aeb0977
changed the use of finetune
Browse files- app/model_handler.py +3 -2
app/model_handler.py
CHANGED
@@ -4,7 +4,8 @@ from .utils import format_prompt_for_hint, format_prompt_for_followup, format_pr
|
|
4 |
from peft import PeftModel, PeftConfig
|
5 |
|
6 |
MODEL_NAME = "Salesforce/codegen-350M-mono"
|
7 |
-
|
|
|
8 |
|
9 |
# Initialize the tokenizer
|
10 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
@@ -25,7 +26,7 @@ model = PeftModel.from_pretrained(
|
|
25 |
device_map="auto"
|
26 |
)
|
27 |
|
28 |
-
# Merge LoRA weights with base model for better inference performance
|
29 |
model = model.merge_and_unload()
|
30 |
|
31 |
def generate_hint(code_snippet, task_description, mode='concise'):
|
|
|
4 |
from peft import PeftModel, PeftConfig
|
5 |
|
6 |
MODEL_NAME = "Salesforce/codegen-350M-mono"
|
7 |
+
# Use a relative path for the LoRA model, assuming it's in the project root
|
8 |
+
LORA_PATH = "./fine-tuned-model"
|
9 |
|
10 |
# Initialize the tokenizer
|
11 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
|
|
26 |
device_map="auto"
|
27 |
)
|
28 |
|
29 |
+
# Merge LoRA weights with base model for better inference performance
|
30 |
model = model.merge_and_unload()
|
31 |
|
32 |
def generate_hint(code_snippet, task_description, mode='concise'):
|