Skip to content

Commit

Permalink
torch.load accommodates cpu
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerthomas1722 committed Sep 13, 2024
1 parent 9a1c990 commit 3b3f3aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cnlpt/api/cnn_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def startup_event():
embed_dims = conf_dict['cnn_embed_dim'],
num_filters=conf_dict['num_filters'],
filters=conf_dict['filters'])
model.load_state_dict(torch.load(join(model_name, 'pytorch_model.bin')), map_location=torch.device(device))
model.load_state_dict(torch.load(join(model_name, 'pytorch_model.bin'), map_location=torch.device(device)))

app.state.model = model.to(device)
app.state.tokenizer = tokenizer
Expand Down

0 comments on commit 3b3f3aa

Please sign in to comment.