Skip to content

Commit

Permalink
fix tmp dir saving (#959)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored Oct 22, 2024
1 parent dcb49ea commit 966c8c2
Show file tree
Hide file tree
Showing 14 changed files with 324 additions and 45 deletions.
3 changes: 3 additions & 0 deletions optimum/exporters/openvino/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def export_tensorflow(
ov_config=ov_config,
library_name=library_name,
)
del ov_model
return input_names, output_names, True


Expand Down Expand Up @@ -268,6 +269,7 @@ def export_pytorch_via_onnx(
ov_config=ov_config,
library_name=library_name,
)
del ov_model
return input_names, output_names, True


Expand Down Expand Up @@ -442,6 +444,7 @@ def ts_patched_forward(*args, **kwargs):
library_name=library_name,
)
clear_class_registry()
del ov_model
del model
gc.collect()
return input_names, output_names, False
Expand Down
3 changes: 2 additions & 1 deletion optimum/intel/openvino/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import warnings
from pathlib import Path
from tempfile import TemporaryDirectory, gettempdir
from tempfile import gettempdir
from typing import Dict, Optional, Union

import openvino
Expand All @@ -41,6 +41,7 @@
ONNX_WEIGHTS_NAME,
OV_TO_PT_TYPE,
OV_XML_FILE_NAME,
TemporaryDirectory,
_print_compiled_model_properties,
model_has_dynamic_inputs,
)
Expand Down
2 changes: 1 addition & 1 deletion optimum/intel/openvino/modeling_base_seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import logging
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Dict, Optional, Union

import openvino
Expand All @@ -36,6 +35,7 @@
OV_DECODER_NAME,
OV_DECODER_WITH_PAST_NAME,
OV_ENCODER_NAME,
TemporaryDirectory,
)


Expand Down
2 changes: 1 addition & 1 deletion optimum/intel/openvino/modeling_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import logging
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union

import numpy as np
Expand Down Expand Up @@ -50,6 +49,7 @@
ONNX_WEIGHTS_NAME,
OV_XML_FILE_NAME,
STR_TO_OV_TYPE,
TemporaryDirectory,
get_export_transformers_version,
model_has_dynamic_inputs,
)
Expand Down
3 changes: 2 additions & 1 deletion optimum/intel/openvino/modeling_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from collections import OrderedDict
from copy import deepcopy
from pathlib import Path
from tempfile import TemporaryDirectory, gettempdir
from tempfile import gettempdir
from typing import Any, Dict, Optional, Union

import numpy as np
Expand Down Expand Up @@ -70,6 +70,7 @@
ONNX_WEIGHTS_NAME,
OV_TO_PT_TYPE,
OV_XML_FILE_NAME,
TemporaryDirectory,
_print_compiled_model_properties,
model_has_dynamic_inputs,
np_to_pt_generators,
Expand Down
2 changes: 1 addition & 1 deletion optimum/intel/openvino/modeling_open_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import logging
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Dict, Optional, Union

import numpy as np
Expand All @@ -39,6 +38,7 @@
from ..utils.modeling_utils import _find_files_matching_pattern, _OpenClipForZeroShotImageClassification
from .configuration import OVConfig, OVWeightQuantizationConfig
from .modeling import MODEL_START_DOCSTRING, OVModel
from .utils import TemporaryDirectory


logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion optimum/intel/openvino/modeling_visual_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import warnings
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Dict, Optional, Tuple, Union

import numpy as np
Expand All @@ -19,6 +18,7 @@
from .configuration import OVConfig, OVWeightQuantizationConfig
from .modeling_base import OVBaseModel, OVModelPart
from .modeling_decoder import CausalLMOutputWithPast, OVModelForCausalLM
from .utils import TemporaryDirectory


logger = logging.getLogger(__name__)
Expand Down
Loading

0 comments on commit 966c8c2

Please sign in to comment.