Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -18,9 +18,9 @@ model = SmollM(config['model']['model_config'])
|
|
18 |
tokenizer = AutoTokenizer.from_pretrained(config['tokenizer']['tokenizer_name_or_path'])
|
19 |
|
20 |
# Load your custom model (adjust as necessary for your model's implementation)
|
21 |
-
model_path = "model.
|
22 |
-
checkpoint = torch.load(
|
23 |
-
model.load_state_dict(checkpoint
|
24 |
model.eval() # Set the model to evaluation mode
|
25 |
|
26 |
def generate_tokens(model, tokenizer, prompt, max_length=50, device="cuda"):
|
|
|
18 |
tokenizer = AutoTokenizer.from_pretrained(config['tokenizer']['tokenizer_name_or_path'])
|
19 |
|
20 |
# Load your custom model (adjust as necessary for your model's implementation)
|
21 |
+
model_path = "model.pt" # Replace with the path to your model weights
|
22 |
+
checkpoint = torch.load(model_path, map_location=torch.device("cpu"))
|
23 |
+
model.load_state_dict(checkpoint)
|
24 |
model.eval() # Set the model to evaluation mode
|
25 |
|
26 |
def generate_tokens(model, tokenizer, prompt, max_length=50, device="cuda"):
|