mirror of
https://github.com/clearml/clearml-serving
synced 2025-01-30 18:36:53 +00:00
Fix torch import
This commit is contained in:
parent
aff27c62b8
commit
9f51a9334f
@ -1,7 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
import gc
|
||||
import torch
|
||||
from collections import deque
|
||||
from pathlib import Path
|
||||
from random import random
|
||||
@ -19,6 +18,11 @@ from clearml.storage.util import hash_dict
|
||||
from .preprocess_service import BasePreprocessRequest
|
||||
from .endpoints import ModelEndpoint, ModelMonitoring, CanaryEP, EndpointMetricLogging
|
||||
|
||||
try:
|
||||
import torch
|
||||
except ImportError:
|
||||
torch = None
|
||||
|
||||
|
||||
class ModelRequestProcessorException(Exception):
|
||||
def __init__(self, message):
|
||||
@ -922,7 +926,8 @@ class ModelRequestProcessor(object):
|
||||
del self._engine_processor_lookup[k]
|
||||
self._engine_processor_lookup.pop(k, None)
|
||||
gc.collect()
|
||||
torch.cuda.empty_cache()
|
||||
if torch:
|
||||
torch.cuda.empty_cache()
|
||||
cleanup = False
|
||||
model_monitor_update = False
|
||||
except Exception as ex:
|
||||
|
@ -1 +1 @@
|
||||
__version__ = '1.3.1'
|
||||
__version__ = '1.3.2'
|
||||
|
Loading…
Reference in New Issue
Block a user