Use pathlib to load model file (#1835)

This commit is contained in:
Ben Letham 2021-03-05 09:55:35 -08:00
parent b5e67e59c3
commit 8882c6a3e3

View file

@ -9,6 +9,7 @@ from abc import abstractmethod, ABC
from typing import Tuple from typing import Tuple
from collections import OrderedDict from collections import OrderedDict
from enum import Enum from enum import Enum
from pathlib import Path
import pickle import pickle
import pkg_resources import pkg_resources
import os import os
@ -282,7 +283,7 @@ class PyStanBackend(IStanBackend):
'fbprophet', 'fbprophet',
'stan_model/prophet_model.pkl', 'stan_model/prophet_model.pkl',
) )
with open(model_file, 'rb') as f: with Path(model_file).open('rb') as f:
return pickle.load(f) return pickle.load(f)