Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -82,7 +82,7 @@ def initiate_model(config, device):
|
|
82 |
model = build_transformer(tokenizer_src.get_vocab_size(), tokenizer_tgt.get_vocab_size(), config["seq_len"], config['seq_len'], d_model=config['d_model']).to(device)
|
83 |
|
84 |
model_filename = latest_weights_file_path(config)
|
85 |
-
state = torch.load(model_filename)
|
86 |
model.load_state_dict(state['model_state_dict'])
|
87 |
return model, tokenizer_src, tokenizer_tgt
|
88 |
|
|
|
82 |
model = build_transformer(tokenizer_src.get_vocab_size(), tokenizer_tgt.get_vocab_size(), config["seq_len"], config['seq_len'], d_model=config['d_model']).to(device)
|
83 |
|
84 |
model_filename = latest_weights_file_path(config)
|
85 |
+
state = torch.load(model_filename, map_location=torch.device('cpu'))
|
86 |
model.load_state_dict(state['model_state_dict'])
|
87 |
return model, tokenizer_src, tokenizer_tgt
|
88 |
|