{"id":13411214,"url":"https://github.com/apple/corenet","last_synced_at":"2025-04-09T00:27:59.118Z","repository":{"id":235616622,"uuid":"788562361","full_name":"apple/corenet","owner":"apple","description":"CoreNet: A library for training deep neural networks","archived":false,"fork":false,"pushed_at":"2024-10-14T17:43:28.000Z","size":4194,"stargazers_count":7000,"open_issues_count":16,"forks_count":545,"subscribers_count":66,"default_branch":"main","last_synced_at":"2025-04-01T23:18:37.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apple.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2024-04-18T16:52:40.000Z","updated_at":"2025-04-01T12:41:55.000Z","dependencies_parsed_at":"2024-05-01T20:02:37.498Z","dependency_job_id":"3e191627-408a-48da-8375-9122187bbc8f","html_url":"https://github.com/apple/corenet","commit_stats":null,"previous_names":["apple/corenet"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fcorenet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fcorenet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fcorenet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fcorenet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apple","download_url":"https://codeload.github.com/apple/corenet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247948599,"owners_count":21023192,"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-07-30T20:01:12.195Z","updated_at":"2025-04-09T00:27:59.082Z","avatar_url":"https://github.com/apple.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook","Project List","Repos","A01_机器学习教程","Model Training and Orchestration"],"sub_categories":["\u003cspan id=\"tool\"\u003eLLM (LLM \u0026 Tool)\u003c/span\u003e"],"readme":"# CoreNet: A library for training deep neural networks\n\nCoreNet is a deep neural network toolkit that allows researchers and engineers to train standard and novel small and large-scale models for variety of tasks, including foundation models (e.g., CLIP and LLM), object classification, object detection, and semantic segmentation.\n\n## Table of contents\n\n   * [What's new?](#whats-new)\n   * [Research efforts at Apple using CoreNet](#research-efforts-at-apple-using-corenet)\n   * [Installation](#installation)\n   * [Directory Structure](#directory-structure)\n   * [Maintainers](#maintainers)\n   * [Contributing to CoreNet](#contributing-to-corenet)\n   * [License](#license)\n   * [Relationship with CVNets](#relationship-with-cvnets)\n   * [Citation](#citation)\n\n## What's new?\n\n   * ***October 2024***: Version 0.1.1 of the CoreNet library includes\n      * [KV Prediction](./projects/kv-prediction/)\n\n## Research efforts at Apple using CoreNet\n\nBelow is the list of publications from Apple that uses CoreNet. Also, training and evaluation recipes, as well as links to pre-trained models, can be found inside the [projects](./projects/) folder. Please refer to it for further details.\n\n   * [KV Prediction for Improved Time to First Token](https://arxiv.org/abs/2410.08391)\n   * [OpenELM: An Efficient Language Model Family with Open Training and Inference Framework](https://arxiv.org/abs/2404.14619)\n   * [CatLIP: CLIP-level Visual Recognition Accuracy with 2.7x Faster Pre-training on Web-scale Image-Text Data](https://arxiv.org/abs/2404.15653)\n   * [Reinforce Data, Multiply Impact: Improved Model Accuracy and Robustness with Dataset Reinforcement](https://arxiv.org/abs/2303.08983)\n   * [CLIP meets Model Zoo Experts: Pseudo-Supervision for Visual Enhancement](https://arxiv.org/abs/2310.14108)\n   * [FastVit: A Fast Hybrid Vision Transformer using Structural Reparameterization](https://arxiv.org/abs/2303.14189)\n   * [Bytes Are All You Need: Transformers Operating Directly on File Bytes](https://arxiv.org/abs/2306.00238)\n   * [MobileOne: An Improved One millisecond Mobile Backbone](https://arxiv.org/abs/2206.04040)\n   * [RangeAugment: Efficient Online Augmentation with Range Learning](https://arxiv.org/abs/2212.10553)\n   * [Separable Self-attention for Mobile Vision Transformers (MobileViTv2)](https://arxiv.org/abs/2206.02680)\n   * [CVNets: High performance library for Computer Vision, ACM MM'22](https://arxiv.org/abs/2206.02002)\n   * [MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer, ICLR'22](https://arxiv.org/abs/2110.02178)\n\n## Installation\n\nYou will need Git LFS (instructions below) to run tests and Jupyter notebooks \n([instructions](https://jupyter.org/install)) in this repository,\nand to contribute to it so we recommend that you install and activate it first.\n\nOn Linux we recommend to use Python 3.10+ and PyTorch (version \u003e= v2.1.0), on\nmacOS system Python 3.9+ should be sufficient.\n\nNote that the optional dependencies listed below are required if you'd like to\nmake contributions and/or run tests.\n\nFor Linux (substitute `apt` for your package manager):\n\n```bash\nsudo apt install git-lfs\n\ngit clone git@github.com:apple/corenet.git\ncd corenet\ngit lfs install\ngit lfs pull\n# The following venv command is optional, but recommended. Alternatively, you can create and activate a conda environment.\npython3 -m venv venv \u0026\u0026 source venv/bin/activate\npython3 -m pip install --editable .\n```\n\nTo install optional dependencies for audio and video processing:\n\n```bash\nsudo apt install libsox-dev ffmpeg\n```\n\nFor macOS, assuming you use Homebrew:\n\n```bash\nbrew install git-lfs\n\ngit clone git@github.com:apple/corenet.git\ncd corenet\ncd \\$(pwd -P)  # See the note below.\ngit lfs install\ngit lfs pull\n# The following venv command is optional, but recommended. Alternatively, you can create and activate a conda environment.\npython3 -m venv venv \u0026\u0026 source venv/bin/activate\npython3 -m pip install --editable .\n```\n\nTo install optional dependencies for audio and video processing:\n\n```bash\nbrew install sox ffmpeg\n```\n\nNote that on macOS the file system is case insensitive, and case sensitivity\ncan cause issues with Git. You should access the repository on disk as if the\npath were case sensitive, i.e. with the same capitalization as you see when you\nlist the directories `ls`. You can switch to such a path with the `cd $(pwd -P)`\ncommand.\n\n\n## Directory Structure\n\nThis section provides quick access and a brief description for important CoreNet directories.\n\n\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003e Description \u003c/th\u003e\n\u003cth\u003e Quick Access \u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003c!-- Row boilerplate (copy-paste the following commented snippet for adding a new row to the table.)\n\u003ctr\u003e \u003ctd\u003e \u003ch3\u003e title \u003c/h3\u003e \ndescription\n\u003c/td\u003e \u003ctd\u003e \u003cpre\u003e\nfolders\n\u003c/pre\u003e \u003c/td\u003e \u003c/tr\u003e\n--\u003e\n\u003ctr\u003e \u003ctd\u003e \u003ch3\u003e Getting Started \u003c/h3\u003e \nWorking with the examples is an easy way to get started with CoreNet. \n\u003c/td\u003e \u003ctd\u003e \u003cpre\u003e\n└── tutorials\n    ├── \u003ca href=\"tutorials/train_a_new_model_on_a_new_dataset_from_scratch.ipynb\"\u003etrain_a_new_model_on_a_new_dataset_from_scratch.ipynb\u003c/a\u003e\n    ├── \u003ca href=\"tutorials/guide_slurm_and_multi_node_training.md\"\u003eguide_slurm_and_multi_node_training.md\u003c/a\u003e\n    ├── \u003ca href=\"tutorials/clip.ipynb\"\u003eclip.ipynb\u003c/a\u003e\n    ├── \u003ca href=\"tutorials/semantic_segmentation.ipynb\"\u003esemantic_segmentation.ipynb\u003c/a\u003e\n    └── \u003ca href=\"tutorials/object_detection.ipynb\"\u003eobject_detection.ipynb\u003c/a\u003e\n\u003c/pre\u003e \u003c/td\u003e \u003c/tr\u003e\n\n\n\u003ctr\u003e \u003ctd\u003e \u003ch3\u003e Training Recipes \u003c/h3\u003e\nCoreNet provides reproducible training recipes, in addition to the pretrained model \nweights and checkpoints for the publications that are listed in \u003ccode\u003eprojects/\u003c/code\u003e directory.\n\nPublication project directories generally contain the following contents:\n\n* `README.md` provides documentation, links to the pretrained weights, and citations.\n* `\u003ctask_name\u003e/\u003cmodel_name\u003e.yaml` provides configuration for reproducing the trainings and evaluations.\n\u003c/td\u003e \u003ctd\u003e \u003cpre\u003e\n└── projects\n    ├── \u003ca href=\"projects/kv-prediction\"\u003ekv-prediction\u003c/a\u003e (*)\n    ├── \u003ca href=\"projects/byteformer\"\u003ebyteformer\u003c/a\u003e\n    ├── \u003ca href=\"projects/catlip\"\u003ecatlip\u003c/a\u003e\n    ├── \u003ca href=\"projects/clip\"\u003eclip\u003c/a\u003e\n    ├── \u003ca href=\"projects/fastvit\"\u003efastvit\u003c/a\u003e\n    ├── \u003ca href=\"projects/mobilenet_v1\"\u003emobilenet_v1\u003c/a\u003e\n    ├── \u003ca href=\"projects/mobilenet_v2\"\u003emobilenet_v2\u003c/a\u003e\n    ├── \u003ca href=\"projects/mobilenet_v3\"\u003emobilenet_v3\u003c/a\u003e\n    ├── \u003ca href=\"projects/mobileone\"\u003emobileone\u003c/a\u003e\n    ├── \u003ca href=\"projects/mobilevit\"\u003emobilevit\u003c/a\u003e\n    ├── \u003ca href=\"projects/mobilevit_v2\"\u003emobilevit_v2\u003c/a\u003e\n    ├── \u003ca href=\"projects/openelm\"\u003eopenelm\u003c/a\u003e\n    ├── \u003ca href=\"projects/range_augment\"\u003erange_augment\u003c/a\u003e\n    ├── \u003ca href=\"projects/resnet\"\u003eresnet\u003c/a\u003e\n    └── \u003ca href=\"projects/vit\"\u003evit\u003c/a\u003e\n\u003cbr\u003e\n(*) Newly released.\n\u003c/pre\u003e \u003c/td\u003e \u003c/tr\u003e\n\n\n\u003ctr\u003e \u003ctd\u003e \u003ch3\u003e MLX Examples \u003c/h3\u003e\nMLX examples demonstrate how to run CoreNet models efficiently on Apple Silicon.\nPlease find further information in the \u003ccode\u003eREADME.md\u003c/code\u003e file within the corresponding example directory.\n\n\u003c/td\u003e \u003ctd\u003e \u003cpre\u003e\n└──mlx_example\n    ├── \u003ca href=\"mlx_examples/clip\"\u003eclip\u003c/a\u003e\n    └── \u003ca href=\"mlx_examples/open_elm\"\u003eopen_elm\u003c/a\u003e\n\u003c/pre\u003e \u003c/td\u003e \u003c/tr\u003e\n\n\n\u003ctr\u003e \u003ctd\u003e \u003ch3\u003e Model Implementations \u003c/h3\u003e \nModels are organized by tasks (e.g. \"classification\"). You can find all model implementations for each\ntask in the corresponding task folder. \n\nEach model class is decorated by a \n`@MODEL_REGISTRY.register(name=\"\u003cmodel_name\u003e\", type=\"\u003ctask_name\u003e\")` decorator. \nTo use a model class in CoreNet training or evaluation,\nassign `models.\u003ctask_name\u003e.name = \u003cmodel_name\u003e` in the YAML configuration.\n\n\u003c/td\u003e \u003ctd\u003e \u003cpre\u003e\n└── corenet\n    └── modeling\n        └── \u003ca href=\"corenet/modeling/models\"\u003emodels\u003c/a\u003e\n            ├── \u003ca href=\"corenet/modeling/models/audio_classification\"\u003eaudio_classification\u003c/a\u003e\n            ├── \u003ca href=\"corenet/modeling/models/classification\"\u003eclassification\u003c/a\u003e\n            ├── \u003ca href=\"corenet/modeling/models/detection\"\u003edetection\u003c/a\u003e\n            ├── \u003ca href=\"corenet/modeling/models/language_modeling\"\u003elanguage_modeling\u003c/a\u003e\n            ├── \u003ca href=\"corenet/modeling/models/multi_modal_img_text\"\u003emulti_modal_img_text\u003c/a\u003e\n            └── \u003ca href=\"corenet/modeling/models/segmentation\"\u003esegmentation\u003c/a\u003e\n\u003c/pre\u003e \u003c/td\u003e \u003c/tr\u003e\n\n\n\u003ctr\u003e \u003ctd\u003e \u003ch3\u003e Datasets \u003c/h3\u003e \nSimilarly to the models, datasets are also categorized by tasks.\n\u003c/td\u003e \u003ctd\u003e \u003cpre\u003e\n└── corenet\n    └── data\n        └── \u003ca href=\"corenet/data/datasets\"\u003edatasets\u003c/a\u003e\n            ├── \u003ca href=\"corenet/data/datasets/audio_classification\"\u003eaudio_classification\u003c/a\u003e\n            ├── \u003ca href=\"corenet/data/datasets/classification\"\u003eclassification\u003c/a\u003e\n            ├── \u003ca href=\"corenet/data/datasets/detection\"\u003edetection\u003c/a\u003e\n            ├── \u003ca href=\"corenet/data/datasets/language_modeling\"\u003elanguage_modeling\u003c/a\u003e\n            ├── \u003ca href=\"corenet/data/datasets/multi_modal_img_text\"\u003emulti_modal_img_text\u003c/a\u003e\n            └── \u003ca href=\"corenet/data/datasets/segmentation\"\u003esegmentation\u003c/a\u003e\n\u003c/pre\u003e \u003c/td\u003e \u003c/tr\u003e\n\n\n\u003ctr\u003e \u003ctd\u003e \u003ch3\u003e Other key directories \u003c/h3\u003e \nIn this section, we have highlighted the rest of the key directories that implement \nclasses corresponding to the names that are referenced in the YAML configurations.\n\u003c/td\u003e \u003ctd\u003e \u003cpre\u003e\n└── corenet\n    ├── \u003ca href=\"corenet/loss_fn\"\u003eloss_fn\u003c/a\u003e\n    ├── \u003ca href=\"corenet/metrics\"\u003emetrics\u003c/a\u003e\n    ├── \u003ca href=\"corenet/optims\"\u003eoptims\u003c/a\u003e\n    │   └── \u003ca href=\"corenet/optims/scheduler\"\u003escheduler\u003c/a\u003e\n    ├── \u003ca href=\"corenet/train_eval_pipelines\"\u003etrain_eval_pipelines\u003c/a\u003e\n    ├── \u003ca href=\"corenet/data\"\u003edata\u003c/a\u003e\n    │   ├── \u003ca href=\"corenet/data/collate_fns\"\u003ecollate_fns\u003c/a\u003e\n    │   ├── \u003ca href=\"corenet/data/sampler\"\u003esampler\u003c/a\u003e\n    │   ├── \u003ca href=\"corenet/data/text_tokenizer\"\u003etext_tokenizer\u003c/a\u003e\n    │   ├── \u003ca href=\"corenet/data/transforms\"\u003etransforms\u003c/a\u003e\n    │   └── \u003ca href=\"corenet/data/video_reader\"\u003evideo_reader\u003c/a\u003e\n    └── \u003ca href=\"corenet/modeling\"\u003emodeling\u003c/a\u003e\n        ├── \u003ca href=\"corenet/modeling/layers\"\u003elayers\u003c/a\u003e\n        ├── \u003ca href=\"corenet/modeling/modules\"\u003emodules\u003c/a\u003e\n        ├── \u003ca href=\"corenet/modeling/neural_augmentor\"\u003eneural_augmentor\u003c/a\u003e\n        └── \u003ca href=\"corenet/modeling/text_encoders\"\u003etext_encoders\u003c/a\u003e\n\u003c/pre\u003e \u003c/td\u003e \u003c/tr\u003e\n\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n## Maintainers\nThis code is developed and maintained by \u003ca href=\"https://mchorton.com\" target=\"_blank\"\u003eMaxwell Horton\u003c/a\u003e, \u003ca href=\"https://www.mohammad.pro\" target=\"_blank\"\u003eMohammad Sekhavat\u003c/a\u003e Yanzi Jin, and \u003ca href=\"https://huggingface.co/depthwise\" target=\"_blank\"\u003eDmitry Belenko\u003c/a\u003e.\n\n### Previous Maintainers\n* \u003ca href=\"https://sacmehta.github.io\" target=\"_blank\"\u003eSachin Mehta\u003c/a\u003e\n* \u003ca href=\"https://farzadab.github.io\" target=\"_blank\"\u003eFarzad Abdolhosseini\u003c/a\u003e\n\n## Contributing to CoreNet\n\nWe welcome PRs from the community! You can find information about contributing to CoreNet in our [contributing](CONTRIBUTING.md) document. \n\nPlease remember to follow our [Code of Conduct](CODE_OF_CONDUCT.md).\n\n## License\n\nFor license details, see [LICENSE](LICENSE). \n\n## Relationship with CVNets\n\nCoreNet evolved from CVNets, to encompass a broader range of applications beyond computer vision. Its expansion facilitated the training of foundational models, including LLMs.\n\n## Citation\n\nIf you find our work useful, please cite the following paper:\n\n``` \n@inproceedings{mehta2022cvnets, \n     author = {Mehta, Sachin and Abdolhosseini, Farzad and Rastegari, Mohammad}, \n     title = {CVNets: High Performance Library for Computer Vision}, \n     year = {2022}, \n     booktitle = {Proceedings of the 30th ACM International Conference on Multimedia}, \n     series = {MM '22} \n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapple%2Fcorenet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapple%2Fcorenet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapple%2Fcorenet/lists"}