-
Notifications
You must be signed in to change notification settings - Fork 176
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
Adds memory snapshot examples #609
Conversation
08_advanced/memory_snapshots/sdxl.py
Outdated
|
||
## Create a modal class with memory snapshots enabled | ||
# | ||
# `checkpointing_enabled=True` creates a Modal class with memory snapshots enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Think you know already that these are stale)
08_advanced/memory_snapshots/sdxl.py
Outdated
self.pipe.to("cpu") | ||
|
||
@modal.enter(checkpoint=False) | ||
def setup(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def setup(self): | |
def load_to_gpu(self): |
08_advanced/memory_snapshots/sdxl.py
Outdated
image = ( | ||
modal.Image.debian_slim() | ||
.pip_install( | ||
"torch", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also these deps should be ==
pinned. Ref Review of synmon on Examples in our Notion.
|
||
image = ( | ||
modal.Image.debian_slim() | ||
.pip_install("transformers", "datasets", "hf_transfer", "torch", "librosa", "soundfile") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also these deps should be ==
pinned. Ref Review of synmon on Examples in our Notion.
.apt_install("ffmpeg", "libsm6", "libxext6") | ||
.env({"HF_HUB_ENABLE_HF_TRANSFER": "1"}) | ||
) | ||
stub = modal.Stub("sdxl", image=image) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These examples should be prefixed with example-
|
||
|
||
|
||
if __name__ == "__main__": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think there should be some docs here explaining that you first need to deploy this app and then run it. Would also be good to catch 'not found' on lookup and print a helpful error about the user likely not deploying
CloudBucketMount
examples
CloudBucketMount
examples…/memory_snapshot_examples
…/memory_snapshot_examples
Adds memory snapshotting examples for:
I'll update the memory snapshotting interface before merging these.
Also adds example for our
CloudBucketMount
where we mount an S3 bucket.