File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -429,6 +429,14 @@ def _from_pretrained(
429429 # Check if the module is in a subdirectory
430430 if (model_save_path / name ).is_dir ():
431431 submodels [name ] = load_method (model_save_path / name )
432+ # For backward compatibility with models exported using previous optimum version, where safety_checker saving was disabled
433+ elif name == "safety_checker" :
434+ logger .warning (
435+ "Pipeline config contains `safety_checker` subcomponent, while `safety_checker` is not available in model directory. "
436+ "`safety_checker` will be disabled. If you want to enable it please set it explicitly to `from_pretrained` method "
437+ "or reexport model with new optimum-intel version"
438+ )
439+ submodels [name ] = None
432440 else :
433441 submodels [name ] = load_method (model_save_path )
434442
You can’t perform that action at this time.
0 commit comments