Spaces:
Build error
Build error
Update llm_utils.py
Browse files- llm_toolkit/llm_utils.py +5 -0
llm_toolkit/llm_utils.py
CHANGED
@@ -78,6 +78,11 @@ def load_model(
|
|
78 |
adapter_name = model.load_adapter(adapter_name_or_path)
|
79 |
model.active_adapters = adapter_name
|
80 |
|
|
|
|
|
|
|
|
|
|
|
81 |
return model, tokenizer
|
82 |
|
83 |
|
|
|
78 |
adapter_name = model.load_adapter(adapter_name_or_path)
|
79 |
model.active_adapters = adapter_name
|
80 |
|
81 |
+
if not tokenizer.pad_token:
|
82 |
+
print("Adding pad token to tokenizer for model: ", model_name)
|
83 |
+
tokenizer.add_special_tokens({"pad_token": "<pad>"})
|
84 |
+
model.resize_token_embeddings(len(tokenizer), pad_to_multiple_of=32)
|
85 |
+
|
86 |
return model, tokenizer
|
87 |
|
88 |
|