{"id":15540040,"url":"https://github.com/blaizzy/neptune-catalyst","last_synced_at":"2025-03-29T00:14:20.174Z","repository":{"id":178452211,"uuid":"371364788","full_name":"Blaizzy/Neptune-Catalyst","owner":"Blaizzy","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-29T11:00:37.000Z","size":4990,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T16:46:49.926Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Blaizzy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-27T12:25:53.000Z","updated_at":"2021-05-29T11:00:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"c7ab6bb3-d790-4978-adf3-11480c3bee1a","html_url":"https://github.com/Blaizzy/Neptune-Catalyst","commit_stats":null,"previous_names":["blaizzy/neptune-catalyst"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blaizzy%2FNeptune-Catalyst","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blaizzy%2FNeptune-Catalyst/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blaizzy%2FNeptune-Catalyst/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blaizzy%2FNeptune-Catalyst/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Blaizzy","download_url":"https://codeload.github.com/Blaizzy/Neptune-Catalyst/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246117761,"owners_count":20726069,"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":[],"created_at":"2024-10-02T12:12:17.415Z","updated_at":"2025-03-29T00:14:20.168Z","avatar_url":"https://github.com/Blaizzy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neptune-Catalyst\n\n**Docs**: https://docs.neptune.ai/integrations-and-supported-tools/model-training/catalyst\n\nIn this repo you will learn how to save all you catalyst experiment metadata to Neptune at every 'scope' of your experiment.\n\nI have to examples to show you:\n - A basic example -\u003e basic.py\n - And a more robust and customized example-\u003e complex.py\n\n\n## [Basic Example](https://github.com/Blaizzy/Neptune-Catalyst/blob/master/basic.py)\n\nIn this example we are going to log data at 3 scopes:\n  - Experiment \n  - Loader \n  - Batch\n  \n### Step 1\n\nInstall catalyst, Neptune and psutil \u0026 Import libraries \n\n`pip install catalyst neptune-client psutils`\n\n### Step 2 \nDefine your hparams, data loaders, model, loss function, optimizer \n\n\n### Step 3 \nDefine you runner and pass arguments to your train() method to setup up your training loop. \nIn order to add log data to Neptune UI you just add neptune logger as one of the arguments and run your code - that's it.\n```python\nmy_runner.train(\n    model=model,\n    criterion=criterion,\n    optimizer=optimizer,\n    loggers={\n        \"neptune\": dl.NeptuneLogger(\n            project=\"common/example-project-catalyst\",\n            tags=[\"datafest\", \"basic\"],\n            name=\"data-fest\",\n        )\n    },\n    loaders=loaders,\n    num_epochs=5,\n    callbacks=[\n        dl.AccuracyCallback(\n            input_key=\"logits\",\n            target_key=\"targets\",\n            topk_args=[1]\n        ),\n    ],\n    hparams=my_hparams,\n    logdir=\"./logs\",\n    valid_loader=\"validation\",\n    valid_metric=\"loss\",\n    minimize_valid_metric=True,\n)\n```\n\n\nOne super exciting thing is that the new version of catalyst log_artifacts was introduced and our logger has support for it.\n\n```python\nmy_runner.log_artifact(\n    path_to_artifact=\"./logs/checkpoints/best.pth\",\n    tag=\"best_model\",\n    scope=\"experiment\"\n)\n```\n\n### Step 4\nNow you explore results in Neptune UI.\n\nJust follow the link to basic persisted view: https://app.neptune.ai/o/common/org/example-project-catalyst/experiments?split=tbl\u0026dash=leaderboard\u0026viewId=d8ced6bb-61c0-48a2-97e2-bf46fb6e4fdb\n\n## [Complex example](https://github.com/Blaizzy/Neptune-Catalyst/blob/master/complex.py)\nSame steps as the basic example but here we do 2 things differently.\n\nWe create a callback that is going to help us log metadata at different scopes of the runner:\n\n**experiment scope**:\n - on end: log best model\n\n**stage scope**:\n - on start: if \"train_frozen\" stage, log sample images\n - on end: if \"train_unfrozen\" stage, log mp4 file\n\n**epoch scope**:\n - on start: log audio file\n\n**loader scope**:\n - on end: log gif\n\n\nWe customize our runner to showcase how to log metadata at different stages:\n - Frozen\n - Unfrozen\n\n\n\nNow you can explore results in Neptune UI.\nJust follow the link to complex persisted view:\nhttps://app.neptune.ai/o/common/org/example-project-catalyst/experiments?split=tbl\u0026dash=leaderboard\u0026viewId=b658dc92-b4c6-4a3f-bece-5191600a5c80\n\t\n# Things to remember\nThere you go, you learned how to:\n\n - connect Neptune to your catalyst experiment \n - Customize your catalyst code to log metadata at different stages\n - You also learned how to use Neptune to visualize, organize and analyze your experiments metadata.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblaizzy%2Fneptune-catalyst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblaizzy%2Fneptune-catalyst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblaizzy%2Fneptune-catalyst/lists"}