Skip to content

Commit

Permalink
separate pickle into pkl, pth, safetensors for cpu only problem
Browse files Browse the repository at this point in the history
  • Loading branch information
BSalita committed Oct 12, 2023
1 parent 4dbcdca commit 436b84c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions SavedModels/predicted_rankings_model.pkl
Git LFS file not shown
3 changes: 3 additions & 0 deletions SavedModels/predicted_rankings_model.pth
Git LFS file not shown
3 changes: 3 additions & 0 deletions SavedModels/predicted_rankings_model.safetensors
Git LFS file not shown
10 changes: 9 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,15 @@ def Predict_Game_Results():
st.error(f"Oops. {predicted_rankings_model_filename} not found.")
return None
with open(predicted_rankings_model_file,'rb') as f:
y_name, columns_to_scale, X_scaler, y_scaler, model_state_dict = pickle.load(f)
y_name, columns_to_scale, X_scaler, y_scaler = pickle.load(f)

predicted_rankings_model_filename = "predicted_rankings_model.pth"
predicted_rankings_model_file = savedModelsPath.joinpath(predicted_rankings_model_filename)
if not predicted_rankings_model_file.exists():
st.error(f"Oops. {predicted_rankings_model_filename} not found.")
return None
with open(predicted_rankings_model_file,'rb') as f:
model_state_dict = torch.load(f, map_location=torch.device('cpu'))

print('y_name:', y_name, 'columns_to_scale:', columns_to_scale)
print(st.session_state.df.info(verbose=True))
Expand Down

0 comments on commit 436b84c

Please sign in to comment.