Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ppqi/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ def load_config(self, modelpath, use_gpu, gpu_id, use_mkldnn, cpu_threads):
print(
'''Error! Unable to use GPU. Please set the environment variables "CUDA_VISIBLE_DEVICES=GPU_id" to use GPU. Now switch to CPU to continue...''')
use_gpu = False

if os.path.isdir(modelpath):

if isinstance(modelpath, Config):
config = modelpath
elif os.path.isdir(modelpath):
if os.path.exists(os.path.join(modelpath, "__params__")):
# __model__ + __params__
model = os.path.join(modelpath, "__model__")
Expand All @@ -87,8 +89,6 @@ def load_config(self, modelpath, use_gpu, gpu_id, use_mkldnn, cpu_threads):
model = modelpath + ".pdmodel"
params = modelpath + ".pdiparams"
config = Config(model, params)
elif isinstance(modelpath, Config):
config = modelpath
else:
raise Exception(
"Error! Can\'t find the model in: %s. Please check your model path." % os.path.abspath(modelpath))
Expand Down