Skip to content

Commit

Permalink
fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rainyfly committed Dec 2, 2022
1 parent 9eade8b commit 41761f8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions visualdl/component/inference/model_convert_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,17 @@ def convert_model(self, format):
identity = hl.hexdigest()
result['request_id'] = identity
target_path = os.path.join(X2PADDLE_CACHE_PATH, identity)
if os.path.exists(target_path): # if data in cache
with open(
if os.path.exists(target_path):
if os.path.exists(
os.path.join(target_path, 'inference_model',
'model.pdmodel'), 'rb') as model_fp:
model_encoded = base64.b64encode(
model_fp.read()).decode('utf-8')
result['pdmodel'] = model_encoded
return result
'model.pdmodel')): # if data in cache
with open(
os.path.join(target_path, 'inference_model',
'model.pdmodel'), 'rb') as model_fp:
model_encoded = base64.b64encode(
model_fp.read()).decode('utf-8')
result['pdmodel'] = model_encoded
return result
else:
os.makedirs(target_path, exist_ok=True)
with tempfile.NamedTemporaryFile() as fp:
Expand Down

0 comments on commit 41761f8

Please sign in to comment.