File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
optimum/exporters/openvino Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ import gc
1516import logging
1617import warnings
1718from pathlib import Path
2829from optimum .intel .utils .import_utils import is_openvino_tokenizers_available , is_transformers_version
2930from optimum .utils .save_utils import maybe_load_preprocessors
3031
32+ from .utils import clear_class_registry
33+
3134
3235if TYPE_CHECKING :
3336 from optimum .intel .openvino .configuration import OVConfig
@@ -367,6 +370,10 @@ class StoreAttr(object):
367370 if convert_tokenizer :
368371 maybe_convert_tokenizers (library_name , output , model , preprocessors )
369372
373+ clear_class_registry ()
374+ del model
375+ gc .collect ()
376+
370377 # Unpatch modules after GPTQ export
371378 if do_gptq_patching :
372379 torch .cuda .is_available = orig_cuda_check
You can’t perform that action at this time.
0 commit comments