{"id":19066136,"url":"https://github.com/epfml/cifar","last_synced_at":"2025-02-22T03:16:21.990Z","repository":{"id":68394343,"uuid":"172709635","full_name":"epfml/cifar","owner":"epfml","description":"MLO internal cifar 10 / 100 default implementation / reference implementation. single machine, variable batch sizes, allowing maybe gradient compression. need to have clear documentation to make it easy to use, and so that we don't loose time with looking for hyperparameters. we can later keep it in sync with mlbench too, but self-contained is even better","archived":false,"fork":false,"pushed_at":"2023-02-08T18:56:19.000Z","size":170,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-01-02T14:27:19.674Z","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/epfml.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":"2019-02-26T12:43:46.000Z","updated_at":"2023-02-08T13:58:29.000Z","dependencies_parsed_at":"2023-03-02T18:45:14.670Z","dependency_job_id":null,"html_url":"https://github.com/epfml/cifar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epfml%2Fcifar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epfml%2Fcifar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epfml%2Fcifar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epfml%2Fcifar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epfml","download_url":"https://codeload.github.com/epfml/cifar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240118419,"owners_count":19750491,"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-11-09T00:54:34.340Z","updated_at":"2025-02-22T03:16:21.985Z","avatar_url":"https://github.com/epfml.png","language":"Python","readme":"# Cifar 10/100 default implementation\n\nMLO internal cifar 10 / 100 reference implementation.\n\n- Single machine\n- Variable batch sizes\n- ...\n\n\n## Getting started\n\n- Install Python 3 and `pip`.\n- Clone this repository and open it.\n- `pip install -r requirements.txt`\n\n\n\n## Code organization\n\n### train.py\nThis file contains the training loop and it sets up the optimization task. It contains a global `config` dictionary that should contain all configurable parameters. This file can be run standalone (`python3 ./train.py`) or by a manager script (see below).\n\n\n### experiments/\nTo do an experiment with specific settings for the `config` dictionary, you can import `train.py` as a module and overwrite its placeholder definitions for `config`, `log_metric` and `output_dir`.\n\nA proper experiment could look like this:\n\n```python\nimport train\n\ntrain.output_dir = 'output/tuning/lr{}_mom{}'.format(lr, mom)\nos.makedirs(train.output_dir)\n\n# Configure the experiment\ntrain.config = dict(\n    dataset='Cifar100',\n    model='resnet18',\n    optimizer='SGD',\n    optimizer_decay_at_epochs=[30, 60, 90, 120, 150, 180, 210, 240, 270],\n    optimizer_decay_with_factor=2.0,\n    optimizer_learning_rate=lr,\n    optimizer_momentum=mom,\n    optimizer_weight_decay=0.0005,\n    batch_size=128,\n    num_epochs=2,\n    seed=42,\n)\n\n# Save the config\nwith open(os.path.join(train.output_dir, 'config.json'), 'w') as fp:\n    json.dump(train.config, fp, indent=' ')\n\n# Configure the logging of scalar measurements\nlogfile = utils.logging.JSONLogger(os.path.join(train.output_dir, 'metrics.json'))\ntrain.log_metric = logfile.log_metric\n\n# Train\nbest_accuracy = train.main()\n```\n\nThe `experiments/` directory contains an example of a hyperparameter [grid search](experiments/grid_search_demo.py).\n\n\n### models/\nThis directory contains model definitions for many popular computer vision networks. They were copied from [kuangliu/pytorch-cifar](https://github.com/kuangliu/pytorch-cifar) and slightly extended by Quentin, Praneeth and Thijs.\n\n\n### hyperparameters/\nThis directory is supposed to contain reference settings for hyperparameters, together with the accuracy they are expected to achieve.\n\n\n### utils/\nMiscelaneous utilities. At the time of writing these docs, this contains accumulators for running averages and max, and a simple logging class.\n\n\n## Runtime\n\n| Model     | Dataset  | Epochs | Hardware             | Time |\n|-----------|----------|--------|----------------------|------|\n| ResNet 18 | Cifar 10 | 300    | 1x Nvidia Tesla V100 | 2:11 |\n| VGG 11    | Cifar 10 | 300    | 1x Nvidia Tesla V100 | 1:06 |\n\n\n## job-monitor\nThis setup is compatible with the work-in-progress [epfml/job-monitor](https://github.com/epfml/job-monitor).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepfml%2Fcifar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepfml%2Fcifar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepfml%2Fcifar/lists"}