Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed examples/__init__.py
Empty file.
25 changes: 25 additions & 0 deletions examples/demo-upload-download.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import litmodels
import torch
from lightning.pytorch.demos.boring_classes import BoringModel

if __name__ == "__main__":
# Define your model
model = BoringModel()

# Save the model's state dictionary
torch.save(model.state_dict(), "./boring-checkpoint.pt")

# Upload the model checkpoint
litmodels.upload_model(
"./boring-checkpoint.pt",
"jirka/kaggle/boring-model",
)

# Download the model checkpoint
model_path = litmodels.download_model("jirka/kaggle/boring-model", download_dir="./my-models")
print(f"Model downloaded to {model_path}")

# Load the model checkpoint
loaded_model = BoringModel()
loaded_model.load_state_dict(torch.load("./boring-checkpoint.pt"))
print(loaded_model)
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading