CoreNet: डीप न्यूरल नेटवर्क प्रशिक्षण के लिए लाइब्रेरी
(github.com/apple)- CoreNet एक toolkit है जो researchers और engineers को CLIP, LLM जैसे foundation models से लेकर object classification, object detection और semantic segmentation तक, विभिन्न tasks के neural network models train करने में सक्षम बनाता है
- अक्टूबर 2024 में CoreNet 0.1.1 में नए project के रूप में KV Prediction शामिल किया गया, और संबंधित research का लक्ष्य Time to First Token में सुधार करना है
- Apple की कई research projects CoreNet का उपयोग करती हैं, और
projects/folder में training/evaluation recipes और pretrained model links साथ में दिए गए हैं - Models और datasets task-specific directories में organized हैं, और model classes
@MODEL_REGISTRY.registerdecorator तथा YAML configuration केmodels.<task_name>.namevalue के जरिए training/evaluation से जुड़ती हैं - CoreNet, CVNets से विकसित होकर computer vision से बाहर के व्यापक applications को शामिल करता है, और LLM सहित foundation models training तक अपना scope बढ़ाता है
CoreNet का उद्देश्य और दायरा
- CoreNet standard models और नए small/large models train करने के लिए एक deep neural network toolkit है
- Supported tasks में ये शामिल हैं
- Foundation models: CLIP, LLM
- Object classification
- Object detection
- Semantic segmentation
अक्टूबर 2024 update
- CoreNet 0.1.1 में KV Prediction project शामिल है
- संबंधित Apple research list में KV Prediction for Improved Time to First Token शामिल है
Apple research और project recipes
- Apple की कई public research projects CoreNet का उपयोग करती हैं
projects/folder में training/evaluation recipes और pretrained model links उपलब्ध हैं- README में शामिल research list इस प्रकार है
- KV Prediction for Improved Time to First Token
- OpenELM: An Efficient Language Model Family with Open Training and Inference Framework
- CatLIP: CLIP-level Visual Recognition Accuracy with 2.7x Faster Pre-training on Web-scale Image-Text Data
- FastVit: A Fast Hybrid Vision Transformer using Structural Reparameterization
- Bytes Are All You Need: Transformers Operating Directly on File Bytes
- MobileOne: An Improved One millisecond Mobile Backbone
- MobileViT, MobileViTv2, CVNets आदि
Installation और runtime requirements
- Tests और Jupyter notebooks चलाने, और contributions के लिए Git LFS install और enable करना आवश्यक है
- Linux पर Python 3.10+ और PyTorch v2.1.0 या उससे ऊपर recommended हैं
- macOS पर system Python 3.9+ पर्याप्त बताया गया है
- Audio/video processing के लिए optional dependencies ये हैं
- Linux:
libsox-dev,ffmpeg - macOS:
sox,ffmpeg
- Linux:
- macOS file system case-sensitive नहीं होता, जिससे Git में समस्या हो सकती है; इसलिए repository को उसी path से access करना चाहिए जिसकी capitalization
lsमें दिखती है
Repository structure और usage flow
tutorials/CoreNet शुरू करने के लिए examples देता है- नए dataset पर नया model train करना
- Slurm और multi-node training guide
- CLIP, semantic segmentation, object detection notebooks
projects/paper-specific reproducible training recipes और pretrained weights/checkpoints देता है- हर project का
README.mddocumentation, pretrained weights links और citation information देता है <task_name>/<model_name>.yamltraining और evaluation reproduce करने के लिए configuration देता है- Project examples में
kv-prediction,byteformer,catlip,clip,fastvit,mobileone,mobilevit,openelm,resnet,vitआदि शामिल हैं
- हर project का
mlx_examples/Apple Silicon पर CoreNet models को efficiently run करने के लिए MLX examples देता है- शामिल examples हैं
clip,open_elm
- शामिल examples हैं
Models, datasets और components
- Model implementations task-wise
corenet/modeling/modelsके अंतर्गत organized हैंaudio_classificationclassificationdetectionlanguage_modelingmulti_modal_img_textsegmentation
- प्रत्येक model class
@MODEL_REGISTRY.register(name="<model_name>", type="<task_name>")decorator से registered होती है - CoreNet training या evaluation में model use करने के लिए YAML configuration में
models.<task_name>.name = <model_name>specify करें - Datasets भी models की तरह task-specific directories में classified हैं
- मुख्य internal components में ये शामिल हैं
loss_fn,metrics,optims,schedulertrain_eval_pipelinescollate_fns,sampler,text_tokenizer,transforms,video_readerlayers,modules,neural_augmentor,text_encoders
CVNets से संबंध
- CoreNet, CVNets से विकसित project है
- इसका विस्तारित scope computer vision से आगे बढ़कर व्यापक applications को शामिल करता है
- यह expansion LLM सहित foundation models training को संभव बनाता है
- CoreNet का उपयोग करने पर README
CVNets: High Performance Library for Computer Visionpaper को cite करने का अनुरोध करता है
1 टिप्पणियां
Hacker News की राय
CoreNet शायद CVNets से विकसित होकर computer vision से बाहर के व्यापक उपयोगों को कवर करने लगा है, और LLM जैसे foundation models की training भी संभव हो गई है
शुरुआत शायद यहीं से हुई होगी: https://apple.github.io/ml-cvnets/index.html
यह training और inference के लिए एक middle-layer implementation जैसा दिखता है, और
default_trainer.py[1] देखने पर engine torch के Tensor इस्तेमाल करता है, लेकिन training method खुद implement किया गया है। learning rate scheduler और optimizer भी खुद implement किए गए हैं, और caller वैकल्पिक रूप से torch का Adam इस्तेमाल कर सकता हैमौजूदा frameworks के साथ मिलकर first-class support जोड़ने के बजाय नीचे से बनाना दिलचस्प चुनाव है, और शायद बहुत Apple-जैसा भी
MLX example फिलहाल inference-only जैसा दिखता है। हालांकि आगे चलकर MLX-specific implementation के आने की landing spot भी हो सकता है: https://github.com/apple/corenet/blob/5b50eca42bc97f6146b812...
हाल में acquire किए गए Datakalab https://news.ycombinator.com/item?id=40114350 और DarwinAI https://news.ycombinator.com/item?id=39709835 को भी देखें, तो अगले 1 साल में Apple कैसे पीछा करता है, यह देखना रोचक होगा
1: https://github.com/apple/corenet/blob/main/corenet/engine/de...
जो researcher model architecture में काफी बदलाव करना चाहते हैं, उनके लिए यह कितना उपयोगी होगा, यह जानने की उत्सुकता है
उदाहरण: https://github.com/apple/corenet/tree/main/projects/clip#tra...
ज्यादातर models training source code, dataset, preprocessing, evaluation code सार्वजनिक नहीं करते। तो क्या high-level implementation कैसी होती है, यह वाकई ज्ञात है?
Apple AI में काफी पीछे रह गया है और अब catch up करने की कोशिश करता दिख रहा है
यह दिलचस्प है कि Apple Jax के ऊपर बनी library https://github.com/apple/axlearn को भी active तरीके से develop करता है
लगता है Apple की machine learning team का आधा हिस्सा PyTorch इस्तेमाल करता है और बाकी आधा Jax। शायद वे Google Cloud और AWS के बीच बंटे हुए हों
अगर एक ही tool पर standardize करने की कोई अच्छी वजह नहीं है, तो आमतौर पर team जिस problem को solve कर रही है और team के experience के हिसाब से tool चुनना आसान होता है
मेरी जानकारी में हर organization के पास काफी autonomy होती है
README में यह भी है:
CatLIP: CLIP-level Visual Recognition Accuracy with 2.7x Faster Pre-training on Web-scale Image-Text DataCatLIP का नाम पहली बार सुना, और link टूटा हुआ लगता है
जानना चाहता हूं CatLIP कितना तेज है। ऊपर वाला OpenAI CLIP-based example भी पहले से तेज है
PyTorch के ऊपर बनाया गया है
जानना चाहता हूं कि इसकी तुलना MLX से कैसे होती है। मेरी समझ के मुताबिक MLX, PyTorch के equivalent है, लेकिन Apple Silicon के लिए optimized है
क्या यह MLX models को distributed तरीके से train करने के लिए है? या इसका मकसद क्या है?
mlx_examples/open_elmमें लिखा है, “MLX is an Apple deep learning framework similar in spirit to PyTorch, which is optimized for Apple Silicon based hardware.”Huggingface Transformers में MPS backend जोड़कर इस्तेमाल करने की तुलना में, इसे इस्तेमाल करने का क्या फायदा है—यह जानना चाहता/चाहती हूँ
mlx_example/clipCoreNet के CLIP model implementation को MLX के CLIP example में बदलने और कुछ custom modifications जोड़ने का example हैFP16 Base variant: PyTorch की तुलना में 60% speed improvement
FP16 Huge variant: 12% speed improvement
mlx_example/open_elmCoreNet से train किए गए OpenELM model का MLX port है। MLX, PyTorch जैसी प्रकृति वाला Apple deep learning framework है और Apple Silicon-आधारित hardware के लिए optimized हैफायदा शायद यह है कि Apple Silicon-specific optimization की वजह से अतिरिक्त speed improvement मिलती है। छोटे models के लिहाज़ से यह सबसे power-efficient deep neural network training framework भी हो सकता है, लेकिन असली benchmarks आने पर ही पता चलेगा
इस repository में कई सुविधाजनक utilities हैं, और common models व evaluation metrics आदि के भी काफ़ी साफ़ implementations हैं
दूसरे शब्दों में, यह inference के बजाय नए models लिखने के लिए ज़्यादा उपयुक्त लगता है
ऐसे repositories में कई models और usage patterns के लिए छोटे API examples को भरोसेमंद तरीके से generate करने वाला LLM agent हो तो अच्छा होगा
जानना चाहता/चाहती हूँ कि क्या यह Apple Silicon पर training को support करता है। अगर मैंने README में कुछ miss नहीं किया है, तो यह बहुत स्पष्ट नहीं है
जब तक आपके पास अपने training use के लिए Apple Silicon-based private servers न हों
folders देखने पर लगता है कि कई classes बस PyTorch और torchvision classes को inherit करती हैं और नया कुछ नहीं करतीं
सभी optimizers, schedulers और ज़्यादातर layers उसी तरह हैं। हालांकि कई papers की layer combinations वाले blocks काफ़ी हैं, और ये
monai.networks.blocksजैसे हैं“components” के लिहाज़ से कुछ नए implemented loss functions और evaluation metrics भी हैं
Apple M1 पर neural network training और inference के लिए कौन-सी library recommend करेंगे, यह जानना चाहता/चाहती हूँ। C++ या Rust में इस्तेमाल करना चाहता/चाहती हूँ, और neural network अधिकतम करीब 5 million parameters का होगा