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

Adds memory snapshot examples #609

Closed
wants to merge 12 commits into from
Closed

Conversation

luiscape
Copy link
Member

@luiscape luiscape commented Feb 29, 2024

Adds memory snapshotting examples for:

  • simple imports
  • Stable Diffusion XL
  • Whisper tiny

I'll update the memory snapshotting interface before merging these.

Also adds example for our CloudBucketMount where we mount an S3 bucket.

@luiscape luiscape self-assigned this Feb 29, 2024
@luiscape luiscape changed the title Adds memory snapshot example for SDXL Adds memory snapshot examples Mar 1, 2024
08_advanced/memory_snapshots/import_torch.py Outdated Show resolved Hide resolved

## Create a modal class with memory snapshots enabled
#
# `checkpointing_enabled=True` creates a Modal class with memory snapshots enabled.
Copy link
Collaborator

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)

self.pipe.to("cpu")

@modal.enter(checkpoint=False)
def setup(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def setup(self):
def load_to_gpu(self):

image = (
modal.Image.debian_slim()
.pip_install(
"torch",
Copy link
Collaborator

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")
Copy link
Collaborator

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)
Copy link
Collaborator

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__":
Copy link
Collaborator

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

@luiscape luiscape changed the title Adds memory snapshot examples Adds memory snapshot and CloudBucketMount examples Mar 6, 2024
@luiscape luiscape changed the title Adds memory snapshot and CloudBucketMount examples Adds memory snapshot examples Mar 7, 2024
@ekzhang ekzhang closed this Aug 28, 2024
@ekzhang ekzhang deleted the luis/memory_snapshot_examples branch August 28, 2024 20:59
@ekzhang ekzhang restored the luis/memory_snapshot_examples branch August 28, 2024 20:59
@ekzhang ekzhang reopened this Aug 28, 2024
@luiscape luiscape closed this Aug 30, 2024
@luiscape luiscape deleted the luis/memory_snapshot_examples branch August 30, 2024 15:30
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.

3 participants