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

Add CLI to install dependencies #104

Merged
merged 4 commits into from
Oct 14, 2024
Merged

Add CLI to install dependencies #104

merged 4 commits into from
Oct 14, 2024

Conversation

tengomucho
Copy link
Collaborator

What does this PR do?

Working with TPU requires installing some dependencies that are as simple to install as adding a pip dependency in the main package. This is even more evident for Jetstream Pytorch, that needs to be installed from a git repository.
Previously I had run the actions manually, added a target on Makefile and a script for it.
@mfuntowicz suggested that might not be practical for someone having the optimum-tpu package but not the sources:
#99 (comment)

As a result, I added a script and integrated it as the optimum-tpu CLI to provide a simple command to install Jetstream Pytorch:

optimum-tpu  install-jetstream-pytorch 

Note that I also added an option to install pytorch xla. This is because in the future I might remove this dependency from optimum-tpu, since it is not required for inference when using Jetstream.

Before submitting

  • Did you make sure to update the documentation with your changes?

Some optimum-tpu dependencies are not indexed on pypi, so a cli is
povided to install those.
Use the python CLI script instead of the shell script.
Ubuntu latest image comes with Python 12, that is not compatible with
torch xla yet.
@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.

@tengomucho tengomucho marked this pull request as ready for review October 11, 2024 14:49
Copy link

@dacorvo dacorvo left a comment

Choose a reason for hiding this comment

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

LGTM, thanks !

Copy link
Member

@mfuntowicz mfuntowicz left a comment

Choose a reason for hiding this comment

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

LGTM thanks for looking into see, can really make a big difference for the end user.

2 small nits otherwise 👌

@@ -15,7 +15,7 @@ concurrency:

jobs:
build_documentation:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
Copy link
Member

Choose a reason for hiding this comment

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

Is 24.04 not supported yet?

Copy link
Collaborator Author

@tengomucho tengomucho Oct 14, 2024

Choose a reason for hiding this comment

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

No, we had the same problem last week on optimum, see here. Ubuntu latest comes with python 12, not supported by torch xla yet.

import typer


TORCH_VER = "2.4.0"
Copy link
Member

Choose a reason for hiding this comment

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

Should you source the version from torch directly? Seems very error prone / easy forgettable in the long run isn't it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was actually thinking in the long run I will try to remove the dependency altogether, so users could install optimum-tpu and then install torch cpu using this CLI: this will allow to avoid installing the cuda dependencies of the default torch package.

@tengomucho tengomucho merged commit 68728ea into main Oct 14, 2024
3 checks passed
@tengomucho tengomucho deleted the polish-install branch October 14, 2024 08:21
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