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

Is it possible to automatically get the torch version from the pdm.lock? #13

Open
amitkparekh opened this issue Aug 28, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@amitkparekh
Copy link

amitkparekh commented Aug 28, 2023

Hi! Thank you for creating and maintaining this! I think it's an excellent resource and it's something that I'll be recommending to many people going forwards!

I noticed that we currently need to specify the version for each package/dependency we want to update/get from the torch repository. Do you think it could be possible that, if the version is not specified in the dependencies array, the plugin checks the current pdm.lock file for the torch version, and then downloads/installs the backend but using that version?

I'm thinking about this because in that way, once a user installs the dependency with pdm add (e.g. pdm add torch), the plugin can then just automatically install the desired backend given the version.

@tgolsson
Copy link
Member

In theory this is possible, and I had something similar at point. The problem is that the version selected by PDM might not be available for all hardware configurations that the user desires. Forcing the user to specify the exact constraint makes this less fragile.

@amitkparekh
Copy link
Author

amitkparekh commented Aug 28, 2023

I understand what you're referring to. What if when no version is present, it grabs from the lockfile? And when a version is present, it uses that one.

(Edit for more background)

One of my personal annoyances is needing to pip install torch again with the right computation backend depending on the hardware I'm using. While I'm used to it, it's something that might not be as obvious or understandable by others who use my codebase.

I'm considering the use-case for ML researchers, who will likely want to just do pdm add torch and leave it. The benefit of encouraging the use of this plugin means that the "right" backend is installed and tracked and explicit for all future users of the codebase.

I am also more than happy to get stuck in with creating a PR if you need an extra pair of hands!

@tgolsson
Copy link
Member

tgolsson commented Aug 28, 2023

PRs are always welcome! Maybe setting the constraint to "auto" or similar in the configuration would be a nice way of opting in? If we "default" to discover I think it should be with a warning, so users have to be explicit about what they expect.

I'm hoping to merge #11 soon, just an FYI. It has a few changes to structure as it drops a bunch of PDM versions and adds a few new ones.

@amitkparekh
Copy link
Author

I agree that a warning/info log there might be useful so that users are aware of the version that is being used when downloading torch.

I have take a run at a PR once #11 goes in? I'm going on vacation soon so it might be in a couple of weeks if that's okay?

@tgolsson
Copy link
Member

tgolsson commented Aug 28, 2023

No worries if it takes time, there is no urgency from my side.

@tgolsson tgolsson added the enhancement New feature or request label Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants