Spaces:
Runtime error
Runtime error
zetavg
commited on
Commit
•
184ef80
1
Parent(s):
0a36bb6
add "print"s in finetune
Browse files
llama_lora/lib/finetune.py
CHANGED
@@ -148,6 +148,7 @@ def train(
|
|
148 |
model = base_model
|
149 |
if isinstance(model, str):
|
150 |
model_name = model
|
|
|
151 |
model = AutoModelForCausalLM.from_pretrained(
|
152 |
base_model,
|
153 |
load_in_8bit=load_in_8bit,
|
@@ -156,10 +157,13 @@ def train(
|
|
156 |
device_map=device_map,
|
157 |
)
|
158 |
if re.match("[^/]+/llama", model_name):
|
|
|
159 |
model.config.pad_token_id = 0
|
160 |
model.config.bos_token_id = 1
|
161 |
model.config.eos_token_id = 2
|
162 |
|
|
|
|
|
163 |
if isinstance(tokenizer, str):
|
164 |
tokenizer_name = tokenizer
|
165 |
try:
|
@@ -173,10 +177,13 @@ def train(
|
|
173 |
raise e
|
174 |
|
175 |
if re.match("[^/]+/llama", tokenizer_name):
|
|
|
176 |
tokenizer.pad_token_id = 0
|
177 |
tokenizer.bos_token_id = 1
|
178 |
tokenizer.eos_token_id = 2
|
179 |
|
|
|
|
|
180 |
# tokenizer.pad_token_id = (
|
181 |
# 0 # unk. we want this to be different from the eos token
|
182 |
# )
|
|
|
148 |
model = base_model
|
149 |
if isinstance(model, str):
|
150 |
model_name = model
|
151 |
+
print(f"Loading base model {model_name}...")
|
152 |
model = AutoModelForCausalLM.from_pretrained(
|
153 |
base_model,
|
154 |
load_in_8bit=load_in_8bit,
|
|
|
157 |
device_map=device_map,
|
158 |
)
|
159 |
if re.match("[^/]+/llama", model_name):
|
160 |
+
print(f"Setting special tokens for LLaMA model {model_name}...")
|
161 |
model.config.pad_token_id = 0
|
162 |
model.config.bos_token_id = 1
|
163 |
model.config.eos_token_id = 2
|
164 |
|
165 |
+
print(f"Loaded model {model_name}")
|
166 |
+
|
167 |
if isinstance(tokenizer, str):
|
168 |
tokenizer_name = tokenizer
|
169 |
try:
|
|
|
177 |
raise e
|
178 |
|
179 |
if re.match("[^/]+/llama", tokenizer_name):
|
180 |
+
print(f"Setting special tokens for LLaMA tokenizer {tokenizer_name}...")
|
181 |
tokenizer.pad_token_id = 0
|
182 |
tokenizer.bos_token_id = 1
|
183 |
tokenizer.eos_token_id = 2
|
184 |
|
185 |
+
print(f"Loaded tokenizer {tokenizer_name}")
|
186 |
+
|
187 |
# tokenizer.pad_token_id = (
|
188 |
# 0 # unk. we want this to be different from the eos token
|
189 |
# )
|