piyushgrover commited on
Commit
7aff8d2
·
verified ·
1 Parent(s): 373955f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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.pth" # Replace with the path to your model weights
22
- checkpoint = torch.load(checkpoint_path, map_location=torch.device("cpu"))
23
- model.load_state_dict(checkpoint['model_state_dict'])
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"):