{"id":37079084,"url":"https://github.com/addtt/boiler-pytorch","last_synced_at":"2026-01-14T09:34:34.258Z","repository":{"id":57415879,"uuid":"233474909","full_name":"addtt/boiler-pytorch","owner":"addtt","description":"Basic framework for model training and evaluation in PyTorch.","archived":false,"fork":false,"pushed_at":"2020-07-27T13:26:19.000Z","size":226,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-03T23:32:12.892Z","etag":null,"topics":["boilerplate","experiment-manager","experiments","framework","pytorch"],"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/addtt.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":"2020-01-12T23:31:35.000Z","updated_at":"2023-09-08T18:02:13.000Z","dependencies_parsed_at":"2022-09-16T08:52:39.557Z","dependency_job_id":null,"html_url":"https://github.com/addtt/boiler-pytorch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/addtt/boiler-pytorch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/addtt%2Fboiler-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/addtt%2Fboiler-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/addtt%2Fboiler-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/addtt%2Fboiler-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/addtt","download_url":"https://codeload.github.com/addtt/boiler-pytorch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/addtt%2Fboiler-pytorch/sbom","scorecard":{"id":166027,"data":{"date":"2025-08-11","repo":{"name":"github.com/addtt/boiler-pytorch","commit":"91ddb9180b4ac85625989a7e27542ff93a1b392c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"44 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6","Warn: Project is vulnerable to: GHSA-6p56-wp2h-9hxr","Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: GHSA-3f63-hfp8-52jq","Warn: Project is vulnerable to: PYSEC-2021-41 / GHSA-3wvg-mj6g-m9cv","Warn: Project is vulnerable to: GHSA-44wm-f244-xhp3","Warn: Project is vulnerable to: GHSA-4fx9-vc88-q2xc","Warn: Project is vulnerable to: PYSEC-2021-35 / GHSA-57h3-9rgr-c24m","Warn: Project is vulnerable to: PYSEC-2021-331 / GHSA-7534-mm45-c74v","Warn: Project is vulnerable to: PYSEC-2021-137 / GHSA-77gc-v2xv-rvvh","Warn: Project is vulnerable to: PYSEC-2021-92 / GHSA-7r7m-5h27-29hp","Warn: Project is vulnerable to: PYSEC-2023-227 / GHSA-8ghj-p4vj-mr35","Warn: Project is vulnerable to: PYSEC-2022-10 / GHSA-8vj2-vxx3-667w","Warn: Project is vulnerable to: PYSEC-2021-36 / GHSA-8xjq-8fcg-g5hw","Warn: Project is vulnerable to: PYSEC-2021-42 / GHSA-95q3-8gr9-gm8w","Warn: Project is vulnerable to: PYSEC-2021-317 / GHSA-98vv-pw6r-q6q4","Warn: Project is vulnerable to: PYSEC-2021-38 / GHSA-9hx2-hgq2-2g4f","Warn: Project is vulnerable to: PYSEC-2022-168 / GHSA-9j59-75qj-795w","Warn: Project is vulnerable to: PYSEC-2021-40 / GHSA-f4w8-cv6p-x6r5","Warn: Project is vulnerable to: PYSEC-2021-69 / GHSA-f5g8-5qq7-938w","Warn: Project is vulnerable to: PYSEC-2021-139 / GHSA-g6rj-rv7j-xwp4","Warn: Project is vulnerable to: PYSEC-2021-71 / GHSA-hf64-x4gq-p99h","Warn: Project is vulnerable to: PYSEC-2021-94 / GHSA-hjfx-8p6c-g7gx","Warn: Project is vulnerable to: GHSA-j7hp-h8jx-5ppr","Warn: Project is vulnerable to: GHSA-jgpv-4h4c-xhw3","Warn: Project is vulnerable to: PYSEC-2022-42979 / GHSA-m2vv-5vj5-2hm7","Warn: Project is vulnerable to: PYSEC-2021-37 / GHSA-mvg9-xffr-p774","Warn: Project is vulnerable to: PYSEC-2021-39 / GHSA-p43w-g3c5-g5mq","Warn: Project is vulnerable to: PYSEC-2022-8 / GHSA-pw3c-h7wp-cvhx","Warn: Project is vulnerable to: PYSEC-2021-93 / GHSA-q5hq-fp76-qmrc","Warn: Project is vulnerable to: PYSEC-2021-138 / GHSA-rwv7-3v45-hg29","Warn: Project is vulnerable to: PYSEC-2021-70 / GHSA-vqcj-wrf2-7v73","Warn: Project is vulnerable to: PYSEC-2022-9 / GHSA-xrcv-f9gm-v42c","Warn: Project is vulnerable to: PYSEC-2023-175","Warn: Project is vulnerable to: GHSA-3749-ghw9-m3mg","Warn: Project is vulnerable to: PYSEC-2022-43015 / GHSA-47fc-vmwq-366v","Warn: Project is vulnerable to: PYSEC-2025-41 / GHSA-53q9-r3pm-6pq6","Warn: Project is vulnerable to: PYSEC-2024-252 / GHSA-5pcm-hx3q-hm94","Warn: Project is vulnerable to: GHSA-887c-mr87-cxwp","Warn: Project is vulnerable to: PYSEC-2024-251 / GHSA-pg7h-5qx3-wjr3","Warn: Project is vulnerable to: PYSEC-2024-250","Warn: Project is vulnerable to: PYSEC-2024-259","Warn: Project is vulnerable to: GHSA-g7vv-2v7x-gj9p"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T14:53:14.041Z","repository_id":57415879,"created_at":"2025-08-16T14:53:14.041Z","updated_at":"2025-08-16T14:53:14.041Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416115,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["boilerplate","experiment-manager","experiments","framework","pytorch"],"created_at":"2026-01-14T09:34:33.523Z","updated_at":"2026-01-14T09:34:34.250Z","avatar_url":"https://github.com/addtt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# boiler-pytorch\n\nBasic framework for training stuff in PyTorch. It's quite tailored to projects \nI've been working on lately, so it's meant for personal use. Its sole purpose is \nto do away with `boilr`plate code, and having it here makes it easier to \nshare it across projects.\n\n## Install\n\n```shell script\npip install boilr\n```\n\n\n## Usage example/template\n\nThere's a usage example that can be useful as template. It's a basic VAE\nfor MNIST quickly hacked together. The example files are:\n- `example.py`\n- `example_evaluate.py`\n- `experiments/mnist_experiment/data.py`\n- `experiments/mnist_experiment/experiment_manager.py`\n- `models/mnist_vae.py`\n\nInstall requirements and run the example:\n\n```shell script\npip install -r requirements.txt\nCUDA_VISIBLE_DEVICES=0 python example.py\n```\n\nFor evaluation:\n\n```shell script\nCUDA_VISIBLE_DEVICES=0 python example_evaluate.py --ll --ll-samples 100 --load $RUN_NAME\n```\nusing the name of the folder in `output/` generated from running the example.\n\n\n\n## Quick reference\n\n\n### Built-in functionalities\n\nThe following functionalities are available out-of-the-box:\n- Easy logging of metrics to tensorboard and to a pickle file. Metrics are collected at every training step, smoothed, and logged/saved at a specified frequency. The amount of smoothing is also customizable.\n- Summaries of the metrics are automatically printed after each training and testing phase. This can be easily customized. \n- Training speed, gradient norm (global and per-parameter), and L2 norm of the model parameters are all automatically logged.\n- It's easy to save images from testing, in a dedicated folder.\n- Gradient clipping (by global norm), controllable through a command-line argument.\n- Automatic model checkpointing, with command-line argument to control the maximum number of recent checkpoints to be kept.\n- Command-line argument to resume training from checkpoint, and everything is taken care of.\n- Progress bar for training and testing, using `tqdm`. Can be switched off.\n- Data-dependent initialization (command-line argument).\n- Reproducibility: set random seed across all devices and Python libraries.\n- A suite of utility classes and methods in the packages `boilr.nn` and `boilr.utils` (most of them for internal use).\nIn particular `boilr.nn.modules` and `boilr.utils.viz` might be more generally useful.\n- A long list of command-line arguments to control some of the behaviour above. \nSome arguments are not directly used, but it's convenient to have them already defined: e.g. if a custom `DataLoader` is necessary, the batch size is easily accessible with `args.batch_size`; and when creating the optimizer, the learning rate is `args.lr`. \n- See `boilr.options` for package-wide options. Usually it's not necessary to change them, but they give some more flexibility.\n\n#### Command-line arguments\n\nThere are built-in command-line arguments with default values. These defaults can be easily \noverridden programmatically when making the experiment class that subclasses `boilr`'s. \nThe built-in arguments are the following:\n- `batch-size`: training batch size (default: None)\n- `test-batch-size`: test batch size (default: None)\n- `lr`: learning rate (default: None)\n- `max-grad-norm`: maximum global norm of the gradient. It is clipped if larger. If None, no clipping is performed. (default: None)\n- `seed`: random seed (default: 54321)\n- `tr-log-every`: log training metrics every this number of training steps (default: 1000)\n- `ts-log-every`: log test metrics every this number of training steps. It must be a multiple of `--tr-log-every` (default: 1000)\n- `ts-img-every`: save test images every this number of training steps. It must be a multiple of `--ts-log-every` (default: same as `--ts-log-every`)\n- `checkpoint-every`: save model checkpoint every this number of training steps (default: 1000)\n- `keep-checkpoint-max`: keep at most this number of most recent model checkpoints (default: 3)\n- `max-steps`: max number of training steps (default: 1e10)\n- `max-epochs`: max number of training epochs (default: 1e7)\n- `nocuda`: do not use cuda (default: False)\n- `descr`: additional description for experiment name\n- `dry-run`: do not save anything to disk (default: False)\n- `resume`: load the run with this name and resume training\n\nAdditionally, for `VAEExperimentManager`, the following arguments are available:\n- `ll-every`: evaluate log likelihood (with the importance-weighted bound) every this number of training steps (default: 50000)\n- `ll-samples`: number of importance-weighted samples to evaluate log likelihood (default: 100)\n\n\n### Getting started\n\n1. subclass a base dataset manager class;\n2. subclass a base model class;\n3. subclass a base experiment manager class (the model class is used in here);\n4. make a short script that creates the experiment object, uses it to create a `boilr.Trainer`, and runs the trainer;\n5. optionally, subclass the base evaluator to set up an \"offline\" evaluation pipeline.\n\nSee below for more details.\n\n#### Dataset manager class (1)\n\nThe class `boilr.data.BaseDatasetManager` must be subclassed. The subclass *must* implement\nthe method `_make_datasets` which should return a tuple `(train, test)` with the training\nand test sets as PyTorch `Dataset`s.\nA basic implementation of `_make_dataloaders` is already provided, but can be overridden to make\ncustom data loaders.\n\n\n#### Model class (2)\n\nOne of the model classes must be subclassed to inherit core methods in the base implementation `boilr.models.BaseModel`.\nThese models also automatically subclass `torch.nn.Module` (so it must implement `forward`).\nIn addition, `boilr.models.BaseGenerativeModel` (subclassing `BaseModel`) defines a method `sample_prior` that must be implemented by subclasses.\n\n\n#### Experiment manager class (3)\n\nOne of the base experiment classes in `boilr.experiments` must be subclassed. The subclass *must* implement:\n- `_make_datamanager` to create the dataset manager, which should subclass `boilr.data.BaseDatasetManager`;\n- `_make_model` to create the model, which should subclass `boilr.models.BaseModel`;\n- `_make_optimizer` to create the optimizer, which should subclass `torch.optim.optimizer.Optimizer`;\n- `forward_pass` to perform a simple single-pass model evaluation and returns losses and metrics;\n- `test_procedure` to evaluate the model on the test set (usually heavily based on the `forward_pass` method).\n\nTypically should be overridden:\n- `_define_args_defaults`, `_add_args`, and `_check_args` (or a subset of these) to manage parsing of command-line arguments;\n- `_make_run_description` which returns a string description of the run, used for output folders;\n- `save_images` to save output images (e.g. reconstructions and samples in VAEs).\n\nMay be overridden for additional control:\n- `post_backward_callback` is called by the `Trainer` after the backward pass but before the optimization step;\n- `get_metrics_dict` translates a dictionary of results to a dictionary of metrics to be logged (by default this simply copies over the keys);\n- `train_log_str` and `test_log_str` return log strings for test and training metrics.\n\n**Note**: The class `VAEExperimentManager` implements default `test_procedure` and `save_images` \nmethods for variational inference with VAEs.\n\n\n#### Example training script (4)\n\n```python\nfrom boilr import Trainer\nfrom my_experiment import MyExperimentClass\n\nif __name__ == \"__main__\":\n    experiment = MyExperimentClass()\n    trainer = Trainer(experiment)\n    trainer.run()\n```\n\n\n#### Offline evaluator class (5)\n\nIf offline evaluation is necessary, `boilr.eval.BaseOfflineEvaluator` can be subclassed by implementing:\n\n- `run` to run the evaluation;\n- as above, `_define_args_defaults`, `_add_args`, and `_check_args` (or a subset of these) to manage parsing of command-line arguments.\n\nThe method `run` can be executed by simply calling the evaluator object.\nSee `example_evaluate.py`.\n\n\n\n### Notes\n\n- It also works without `tensorboard`, but it won't save tensorboard logs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faddtt%2Fboiler-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faddtt%2Fboiler-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faddtt%2Fboiler-pytorch/lists"}