huggingface / optimum-intel

🤗 Optimum Intel: Accelerate inference with Intel optimization tools
https://huggingface.co/docs/optimum/main/en/intel/index
Apache License 2.0
364 stars 101 forks source link

Update imports in examples/notebooks #687

Closed helena-intel closed 3 months ago

helena-intel commented 3 months ago

Update examples/notebooks to use from optimum.intel import ... instead of from optimum.intel.openvino import .... This is best practice, and it prevents difficult to debug errors. For example, if accelerate is not installed and you import OVTrainer, you get a friendly error with the new import but not with the old version.

Also

@AlexKoff88 unrelated to this PR, the audio classification example fails with this error:

FAILED examples/openvino/test_examples.py::TestExamples::test_audio_classification - nncf.errors.ValidationError: No match has been found among the model operations for the following ignored/target scope definitions:
 - ignored_scope: ['{re}.*__truediv__.*', '{re}.*matmul_1']
Refer to the original_graph.dot to discover the operations in the model currently visible to NNCF and specify the ignored/target scopes in terms of the names there.
HuggingFaceDocBuilderDev commented 3 months ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

echarlaix commented 3 months ago

Can you take a look at the failing test_audio_classification examples before we can merge @helena-intel ?

helena-intel commented 3 months ago

Can you take a look at the failing test_audio_classification examples before we can merge @helena-intel ?

It looks like the issue is caused by the nncf_compression_config not being used. In https://github.com/huggingface/optimum-intel/blob/main/optimum/intel/openvino/configuration.py#L313 compression is set to None. I changed it to kwargs.get("compression", None).

echarlaix commented 3 months ago

thanks a lot for the fix @helena-intel