2 पॉइंट द्वारा GN⁺ 2024-04-25 | 1 टिप्पणियां | WhatsApp पर शेयर करें
  • 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.register decorator तथा YAML configuration के models.<task_name>.name value के जरिए 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

Apple research और project recipes

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
  • 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.md documentation, pretrained weights links और citation information देता है
    • <task_name>/<model_name>.yaml training और evaluation reproduce करने के लिए configuration देता है
    • Project examples में kv-prediction, byteformer, catlip, clip, fastvit, mobileone, mobilevit, openelm, resnet, vit आदि शामिल हैं
  • mlx_examples/ Apple Silicon पर CoreNet models को efficiently run करने के लिए MLX examples देता है
    • शामिल examples हैं clip, open_elm

Models, datasets और components

  • Model implementations task-wise corenet/modeling/models के अंतर्गत organized हैं
    • audio_classification
    • classification
    • detection
    • language_modeling
    • multi_modal_img_text
    • segmentation
  • प्रत्येक 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, scheduler
    • train_eval_pipelines
    • collate_fns, sampler, text_tokenizer, transforms, video_reader
    • layers, 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 Vision paper को cite करने का अनुरोध करता है

1 टिप्पणियां

 
GN⁺ 2024-04-25
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...

    • interface भी काफी Apple-जैसा दिखता है। ऐसा structure लगता है जिसमें आप config file बनाते हैं, पहले से सोचा हुआ model और hyperparameters डालते हैं, और यह एक simple interface देता है
      जो researcher model architecture में काफी बदलाव करना चाहते हैं, उनके लिए यह कितना उपयोगी होगा, यह जानने की उत्सुकता है
      उदाहरण: https://github.com/apple/corenet/tree/main/projects/clip#tra...
    • project के बारे में बात सही है, लेकिन PyTorch Mace पर चलता है और TensorFlow को भी Apple ने Mac पर port किया था
    • training और inference के middle-layer implementation जैसा दिखता है—इस बात पर, मैं इस field को अच्छी तरह नहीं जानता, लेकिन जानना चाहता हूं कि modern training implementation असल में कैसी दिखती है
      ज्यादातर models training source code, dataset, preprocessing, evaluation code सार्वजनिक नहीं करते। तो क्या high-level implementation कैसी होती है, यह वाकई ज्ञात है?
    • इसे खुद का implementation कहना मुश्किल है; optimizers तो बस PyTorch optimizers को inherit करते हैं
    • मौजूदा frameworks के साथ मिलकर first-class support जोड़ने के बजाय नीचे से बनाने का चुनाव, WWDC से पहले कुछ हड़बड़ी में तैयार किया हुआ लगता है
      Apple AI में काफी पीछे रह गया है और अब catch up करने की कोशिश करता दिख रहा है
  • यह दिलचस्प है कि Apple Jax के ऊपर बनी library https://github.com/apple/axlearn को भी active तरीके से develop करता है
    लगता है Apple की machine learning team का आधा हिस्सा PyTorch इस्तेमाल करता है और बाकी आधा Jax। शायद वे Google Cloud और AWS के बीच बंटे हुए हों

    • Apple जैसी बड़ी companies में यह काफी आम है। coordination cost असल में बड़ी होती है
      अगर एक ही tool पर standardize करने की कोई अच्छी वजह नहीं है, तो आमतौर पर team जिस problem को solve कर रही है और team के experience के हिसाब से tool चुनना आसान होता है
    • मैंने सीधे काम तो नहीं किया, लेकिन हमेशा सुना है कि Apple, Meta जैसी एक consistent organization के बजाय कई companies या startups के bundle जैसा है
      मेरी जानकारी में हर organization के पास काफी autonomy होती है
  • README में यह भी है:
    CatLIP: CLIP-level Visual Recognition Accuracy with 2.7x Faster Pre-training on Web-scale Image-Text Data
    CatLIP का नाम पहली बार सुना, और link टूटा हुआ लगता है

  • PyTorch के ऊपर बनाया गया है

  • जानना चाहता हूं कि इसकी तुलना MLX से कैसे होती है। मेरी समझ के मुताबिक MLX, PyTorch के equivalent है, लेकिन Apple Silicon के लिए optimized है
    क्या यह MLX models को distributed तरीके से train करने के लिए है? या इसका मकसद क्या है?

    • MLX भी इस plan का हिस्सा लगता है। https://github.com/apple/corenet में April में released components में से एक के रूप में MLX examples listed हैं
    • mlx_examples/open_elm में लिखा है, “MLX is an Apple deep learning framework similar in spirit to PyTorch, which is optimized for Apple Silicon based hardware.”
    • README को skim करने पर यह MLX के ऊपर की layer जैसा दिखता है। machine learning को आसान बनाने वाली framework layer के ज्यादा करीब लगता है
  • Huggingface Transformers में MPS backend जोड़कर इस्तेमाल करने की तुलना में, इसे इस्तेमाल करने का क्या फायदा है—यह जानना चाहता/चाहती हूँ

    • “MLX examples demonstrate how to run CoreNet models efficiently on Apple Silicon. Please find further information in the README.md file within the corresponding example directory.”
      mlx_example/clip CoreNet के 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_elm CoreNet से 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 आने पर ही पता चलेगा
    • यहाँ का implementation काफ़ी साफ़ और modular दिखता है, जबकि Transformers और Diffusers तब तक वैसे नहीं हैं जब तक उनके modules को अलग से निकालकर इस्तेमाल न किया जाए
      इस repository में कई सुविधाजनक utilities हैं, और common models व evaluation metrics आदि के भी काफ़ी साफ़ implementations हैं
      दूसरे शब्दों में, यह inference के बजाय नए models लिखने के लिए ज़्यादा उपयुक्त लगता है
    • कुछ खास नहीं है; मूल रूप से यह Apple logo लगा हुआ PyTorch है
  • ऐसे repositories में कई models और usage patterns के लिए छोटे API examples को भरोसेमंद तरीके से generate करने वाला LLM agent हो तो अच्छा होगा

  • जानना चाहता/चाहती हूँ कि क्या यह Apple Silicon पर training को support करता है। अगर मैंने README में कुछ miss नहीं किया है, तो यह बहुत स्पष्ट नहीं है

    • पता नहीं ऐसी training capability छोटे experiments के अलावा उपयोगी होगी या नहीं। Apple अब server products नहीं बनाता, और जब बनाता था तब भी वे महंगे थे
      जब तक आपके पास अपने training use के लिए Apple Silicon-based private servers न हों
    • MLX examples शायद इसे संभव बनाते हैं। यह Mac-only के बजाय general-purpose framework जैसा दिखता है
  • 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 का होगा

    • शुरुआती point के तौर पर मैं PyTorch इस्तेमाल करूँगा/करूँगी। Apple Silicon पर Metal backend काफ़ी तेज़ है, और hobby developers से लेकर foundation model developers तक सबसे ज़्यादा इस्तेमाल की जाने वाली library है