Skip to content

Conversation

@dtrawins
Copy link

@dtrawins dtrawins commented Feb 16, 2024

Support for execution with multi concurrency

  • Adding clone operation to model objects which creates new execution context without duplicating compiled_model and memory usage. It enables multi-concurrency in multithreaded applications.
  • request attribute is now deprecated - new attributes compiled_model and infer_request are added instead - they match OpenVINO objects
  • improved performance for decoder models by eliminating creating new requests for each inference

Before submitting

  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@dtrawins
Copy link
Author

This PR is a replacement for #519

@HuggingFaceDocBuilderDev

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.

self.request = core.compile_model(self.model, self.device, self.ov_config)
logger.info(f"Compiling the {self._model_name} to {self.device} with config {self.ov_config} ... ")
self.compiled_model = core.compile_model(self.model, self.device, self.ov_config)
self.request = self.compiled_model # Deprecated attribute, use compiled_model instead
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can there be a DeprecationWarning when people use self.request, so they know it's deprecated?

@@ -0,0 +1,2 @@
optimum-intel[openvino, nncf]"@git+https://github.com/huggingface/optimum-intel.git
transformers No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
transformers

transformers is a dependency of optimum-intel


def clone(self):
self.compile()
model_cloned = self.__class__(self.model, config=self.config, compile=False, dynamic_shapes=False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why dynamic_shapes=False?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants