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