Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,25 +19,17 @@ def load_model_org():
|
|
| 19 |
return model, tokenizer
|
| 20 |
|
| 21 |
def load_model():
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
MODEL_NAME,
|
| 25 |
-
trust_remote_code=True
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
print("Loading configuration...")
|
| 29 |
-
config = AutoConfig.from_pretrained(MODEL_NAME)
|
| 30 |
-
# Set the correct vocab size to match your fine-tuned model
|
| 31 |
-
config.vocab_size = 128256
|
| 32 |
-
|
| 33 |
-
print("Loading model...")
|
| 34 |
model = AutoModelForCausalLM.from_pretrained(
|
| 35 |
MODEL_NAME,
|
| 36 |
-
config=config, # Use the modified config
|
| 37 |
torch_dtype=torch.float16,
|
| 38 |
device_map="auto",
|
| 39 |
trust_remote_code=True,
|
|
|
|
| 40 |
)
|
|
|
|
|
|
|
| 41 |
return model, tokenizer
|
| 42 |
|
| 43 |
# Initialize model and tokenizer
|
|
|
|
| 19 |
return model, tokenizer
|
| 20 |
|
| 21 |
def load_model():
|
| 22 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
| 23 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
model = AutoModelForCausalLM.from_pretrained(
|
| 25 |
MODEL_NAME,
|
|
|
|
| 26 |
torch_dtype=torch.float16,
|
| 27 |
device_map="auto",
|
| 28 |
trust_remote_code=True,
|
| 29 |
+
load_in_8bit=False
|
| 30 |
)
|
| 31 |
+
|
| 32 |
+
model.resize_token_embeddings(len(tokenizer))
|
| 33 |
return model, tokenizer
|
| 34 |
|
| 35 |
# Initialize model and tokenizer
|