[MO] Raise exception for older nncf models (#18890)
* [PT FE] Call strip() for older nncf models * Raise excception on older nncf models * Update legacy mo too
This commit is contained in:
parent
74a608592a
commit
361367393b
@ -19,6 +19,17 @@ def get_pytorch_decoder(model, input_shape, example_inputs, args):
|
||||
except Exception as e:
|
||||
log.error("PyTorch frontend loading failed")
|
||||
raise e
|
||||
try:
|
||||
import nncf
|
||||
from nncf.torch.nncf_network import NNCFNetwork
|
||||
from packaging import version
|
||||
|
||||
if isinstance(model, NNCFNetwork):
|
||||
if version.parse(nncf.__version__) < version.parse("2.6"):
|
||||
raise RuntimeError(
|
||||
"NNCF models produced by nncf<2.6 are not supported directly. Please export to ONNX first.")
|
||||
except:
|
||||
pass
|
||||
inputs = prepare_torch_inputs(example_inputs, input_shape, args.get("input"), allow_none=True)
|
||||
decoder = TorchScriptPythonDecoder(model, example_input=inputs)
|
||||
args['input_model'] = decoder
|
||||
|
@ -19,6 +19,17 @@ def get_pytorch_decoder(model, example_inputs, args):
|
||||
except Exception as e:
|
||||
log.error("PyTorch frontend loading failed")
|
||||
raise e
|
||||
try:
|
||||
import nncf
|
||||
from nncf.torch.nncf_network import NNCFNetwork
|
||||
from packaging import version
|
||||
|
||||
if isinstance(model, NNCFNetwork):
|
||||
if version.parse(nncf.__version__) <= version.parse("2.6"):
|
||||
raise RuntimeError(
|
||||
"NNCF models produced by nncf<2.6 are not supported directly. Please export to ONNX first.")
|
||||
except:
|
||||
pass
|
||||
inputs = prepare_torch_inputs(example_inputs, args.get("input"), allow_none=True)
|
||||
decoder = TorchScriptPythonDecoder(model, example_input=inputs)
|
||||
args['input_model'] = decoder
|
||||
|
Loading…
Reference in New Issue
Block a user