Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the installation of optimum-neuron through optimum extras #1778

Merged
merged 3 commits into from
Apr 8, 2024

Conversation

JingyaHuang
Copy link
Contributor

What does this PR do?

Fixes huggingface/optimum-neuron#490

Make it possible to install the latest optimum-neuron, with neuron extra optimum[neuron] and optimum[neuronx].

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@JingyaHuang
Copy link
Contributor Author

JingyaHuang commented Mar 27, 2024

Could you review? @philschmid @shub-kris @dacorvo @michaelbenayoun

Tested with testpypi: https://test.pypi.org/manage/project/optimum/release/1.17.2/, should work:

pip install -i https://testpypi.python.org/pypi --upgrade-strategy eager optimum[neuronx]

Installed:

(optimum_setup_test) ubuntu@ip-xxx-xx-xx-xx:~$ pip show optimum
Name: optimum
Version: 1.17.0
Summary: Optimum Library is an extension of the Hugging Face Transformers library, providing a framework to integrate third-party libraries from Hardware Partners and interface with their specific functionality.
Home-page: https://github.com/huggingface/optimum
Author: HuggingFace Inc. Special Ops Team
Author-email: hardware@huggingface.co
License: Apache
Location: /home/ubuntu/pyvenv/optimum_setup_test/lib/python3.8/site-packages
Requires: coloredlogs, datasets, huggingface-hub, numpy, packaging, sympy, torch, transformers
Required-by: optimum-neuron
(optimum_setup_test) ubuntu@ip-xxx-xx-xx-xx:~$ pip show optimum-neuron
Name: optimum-neuron
Version: 0.0.20
Summary: Optimum Neuron is the interface between the Hugging Face Transformers and Diffusers libraries and AWS Tranium and Inferentia accelerators. It provides a set of tools enabling easy model loading, training and inference on single and multiple neuron core settings for different downstream tasks.
Home-page: https://huggingface.co/hardware/aws
Author: HuggingFace Inc. Special Ops Team
Author-email: hardware@huggingface.co
License: Apache
Location: /home/ubuntu/pyvenv/optimum_setup_test/lib/python3.8/site-packages
Requires: accelerate, huggingface-hub, numpy, optimum, protobuf, transformers
Required-by: 

setup.py Outdated
Comment on lines 84 to 85
"neuron": ["optimum-neuron[neuron]>=0.0.20", "transformers == 4.36.2", "accelerate == 0.23.0"],
"neuronx": ["optimum-neuron[neuronx]>=0.0.20", "transformers == 4.36.2", "accelerate == 0.23.0"],
Copy link
Member

Choose a reason for hiding this comment

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

The issue with that is that when we update transformers and / or accelerate requirements we will need to make an optimum release as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The other possibility is to remove transformers from REQUIRED_PKGS of optimum, but in this way every subpackage need to add transformers in their requirement, and we need to sync a release... @mfuntowicz

@JingyaHuang
Copy link
Contributor Author

Remove accelerate since it's not in REQUIRED_PKGS so irrelevant.

Copy link
Member

@michaelbenayoun michaelbenayoun left a comment

Choose a reason for hiding this comment

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

Alright, then let's do it!

@JingyaHuang
Copy link
Contributor Author

Will merge this once optimum neuron 0.0.21 is out to test the combination works as expected.

@JingyaHuang JingyaHuang merged commit 2ac676d into huggingface:main Apr 8, 2024
55 of 59 checks passed
@JingyaHuang JingyaHuang deleted the improve-neuron-extra branch April 8, 2024 23:08
JingyaHuang added a commit that referenced this pull request Apr 9, 2024
@JingyaHuang
Copy link
Contributor Author

FYI @shub-kris

The installation of Optimum Neuron should be correct with

pip install --upgrade-strategy eager optimum[neuronx]

(the latest optimum 1.18.1 and optimum-neuron 0.0.21 shall be installed)

young-developer pushed a commit to young-developer/optimum that referenced this pull request May 10, 2024
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.

Installation instructions are unclear
2 participants