{"id":20717210,"url":"https://github.com/nateraw/hf-hub-lightning","last_synced_at":"2025-04-23T13:33:04.777Z","repository":{"id":58527509,"uuid":"421625018","full_name":"nateraw/hf-hub-lightning","owner":"nateraw","description":"A PyTorch Lightning Callback for pushing models to the Hugging Face Hub 🤗⚡️","archived":false,"fork":false,"pushed_at":"2022-05-13T03:39:21.000Z","size":19,"stargazers_count":36,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T00:05:39.581Z","etag":null,"topics":["huggingface","machine-learning","pytorch-lightning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nateraw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-27T00:26:17.000Z","updated_at":"2024-11-14T17:19:16.000Z","dependencies_parsed_at":"2022-09-12T22:13:20.484Z","dependency_job_id":null,"html_url":"https://github.com/nateraw/hf-hub-lightning","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nateraw%2Fhf-hub-lightning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nateraw%2Fhf-hub-lightning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nateraw%2Fhf-hub-lightning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nateraw%2Fhf-hub-lightning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nateraw","download_url":"https://codeload.github.com/nateraw/hf-hub-lightning/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250145036,"owners_count":21382337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["huggingface","machine-learning","pytorch-lightning"],"created_at":"2024-11-17T03:08:08.684Z","updated_at":"2025-04-23T13:33:04.729Z","avatar_url":"https://github.com/nateraw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hf-hub-lightning\n\n\u003ca href=\"https://colab.research.google.com/github/nateraw/hf-hub-lightning/blob/main/examples/hf_hub_lightning_demo.ipynb\" target=\"_parent\"\u003e\u003cimg src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/\u003e\u003c/a\u003e\n\nA callback for pushing lightning models to the Hugging Face Hub.\n\n**Note:** I made this package for myself, mostly...if folks seem to be interested in it, we'll move this into `huggingface_hub` or an official PyTorch Lightning repo directly and archive this one. Since there are a lot of options/considerations, I decided to just post it separately for now as a proof of concept. \n\n## Setup\n\n```\npip install hf-hub-lightning\n```\n\n## Usage\n\nTo periodically upload your model ckpt and TensorBoard logs while training, you can do the following...\n\n```python\nimport pytorch_lightning as pl\nfrom hf_hub_lightning import HuggingFaceHubCallback\n\ntrain_dataloader = ...\nmodel = YourCoolModel()\ntrainer = pl.Trainer(callbacks=[HuggingFaceHubCallback('your_username/model_id')])\ntrainer.fit(model, train_dataloader)\n```\n\nTo load your model back from the huggingface hub, just do...\n\n```python\nfrom huggingface_hub import hf_hub_download\n\nckpt_path = hf_hub_download('your_username/model_id', 'lit_model.ckpt')\nmodel = YourCoolModel.load_from_checkpoint(ckpt_path)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnateraw%2Fhf-hub-lightning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnateraw%2Fhf-hub-lightning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnateraw%2Fhf-hub-lightning/lists"}