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

Deprecate old GPU classes #2848

Merged
merged 6 commits into from
Feb 10, 2025
Merged

Deprecate old GPU classes #2848

merged 6 commits into from
Feb 10, 2025

Conversation

erikbern
Copy link
Contributor

@erikbern erikbern commented Feb 8, 2025

Going forward the only sanctioned way to configure GPU is through strings. This is nice because it's a lot less code.

Changelog

  • Deprecate the GPU classes (gpu=A100(...) etc) in favor of just using strings (gpu="A100" etc)

Copy link
Contributor

@mwaskom mwaskom left a comment

Choose a reason for hiding this comment

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

One thing that we use the GPU classes for is to document the details of each GPU in the docstring for the relevant class so that it shows up here: https://modal.com/docs/reference/modal.gpu

I think we need to move most of this reference page to a "guide" page so that the information is preserved (and can be updated independently of the client in the future).

I would also add some notes on the deprecation of the GPU classes to this page, i.e. in the docstring to the modal.gpu module.

modal/gpu.py Outdated
return api_pb2.GPUConfig()
else:
raise InvalidError(f"Invalid GPU config: {value}. Value must be a string, a `GPUConfig` object, or `None`.")
raise InvalidError(
f"Invalid GPU config: {value}. Value must be a string or `None` (or a deprecated `_GPUConfig` object)."
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we pointing users towards the private version of the object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

_GPUConfig is just the base class of all the public objects

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah just seems confusing to mention it in a public error message. Maybe "or a modal.gpu object, although these are deprecated"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure sgtm, i can update

@erikbern
Copy link
Contributor Author

erikbern commented Feb 10, 2025

One thing that we use the GPU classes for is to document the details of each GPU in the docstring for the relevant class so that it shows up here: https://modal.com/docs/reference/modal.gpu

I think we need to move most of this reference page to a "guide" page so that the information is preserved (and can be updated independently of the client in the future).

I actually did this last week. We used to link to the reference from the guide when listing all the GPU types, but the guide now lists all the GPU types instead: https://modal.com/docs/guide/gpu (although we should probably expand this). I think it makes more sense to have an exhaustive list of GPU types in the guide and not the reference.

I would also add some notes on the deprecation of the GPU classes to this page, i.e. in the docstring to the modal.gpu module.

Sure can do

@mwaskom
Copy link
Contributor

mwaskom commented Feb 10, 2025

Oh nice I missed that. I do see a couple uses of the modal.gpu objects on that page. Probably also there are some integration tests we need to update?

@erikbern
Copy link
Contributor Author

erikbern commented Feb 10, 2025

Oh nice I missed that. I do see a couple uses of the modal.gpu objects on that page. Probably also there are some integration tests we need to update?

We don't use GPUs in integration tests but I have some separate PRs to update a few things that was using modal.gpu internally. And I updated all examples here: modal-labs/modal-examples#1066

@erikbern erikbern requested a review from mwaskom February 10, 2025 16:00
Copy link
Contributor

@mwaskom mwaskom left a comment

Choose a reason for hiding this comment

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

LGTM modulo the error message

modal/gpu.py Outdated
return api_pb2.GPUConfig()
else:
raise InvalidError(f"Invalid GPU config: {value}. Value must be a string, a `GPUConfig` object, or `None`.")
raise InvalidError(
f"Invalid GPU config: {value}. Value must be a string or `None` (or a deprecated `_GPUConfig` object)."
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah just seems confusing to mention it in a public error message. Maybe "or a modal.gpu object, although these are deprecated"?

@erikbern erikbern force-pushed the erikbern/deprecate-gpu-classes branch from c687b14 to c02cf66 Compare February 10, 2025 19:24
@erikbern erikbern merged commit 08cdea1 into main Feb 10, 2025
20 of 21 checks passed
@erikbern erikbern deleted the erikbern/deprecate-gpu-classes branch February 10, 2025 19:41
@erikbern
Copy link
Contributor Author

Thanks @mwaskom!

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.

2 participants