diff --git a/clearml_serving/serving/model_request_processor.py b/clearml_serving/serving/model_request_processor.py index 35f5120..2fcdcab 100644 --- a/clearml_serving/serving/model_request_processor.py +++ b/clearml_serving/serving/model_request_processor.py @@ -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: diff --git a/clearml_serving/version.py b/clearml_serving/version.py index 72837bd..e398332 100644 --- a/clearml_serving/version.py +++ b/clearml_serving/version.py @@ -1 +1 @@ -__version__ = '1.3.1' +__version__ = '1.3.2'