- Google के Gemma मॉडल्स के लिए हल्का, standalone C++ inference engine
- यह प्रोजेक्ट किनके लिए है?
- आधुनिक large language model (LLM) inference engines पारंपरिक neural network runtimes से आगे बढ़कर customized capabilities वाले जटिल systems हैं
- high-level algorithms और low-level computation के co-design के ज़रिए research और innovation के अवसर हैं, लेकिन experimentation के लिए design न किए गए C++ inference runtimes और low-level computation को abstract करने वाले Python-केंद्रित ML research frameworks के बीच एक gap मौजूद है
- gemma.cpp, Gemma 2B और 7B मॉडल्स का minimal implementation प्रदान करता है और generality की बजाय simplicity और directness पर ज़ोर देता है
- gemma.cpp का लक्ष्य experimentation और research use cases है, इसे minimal dependencies के साथ दूसरे projects में आसानी से integrate किया जा सकता है, और लगभग 2K LoC के core implementation तथा 4K LoC की supporting utilities के कारण इसे आसानी से modify किया जा सकता है
- CPU inference के लिए Google Highway Library के portable SIMD का उपयोग करता है
- production deployment के लिए JAX, Keras, PyTorch, Transformers जैसे Python frameworks का उपयोग करने वाले standard deployment path की सिफारिश की जाती है
त्वरित शुरुआत
सिस्टम आवश्यकताएँ
- शुरू करने से पहले CMake, Clang C++ compiler (C++17 या उससे ऊपर का support), और Kaggle से archive extract करने के लिए
tar इंस्टॉल होना चाहिए
चरण 1: Kaggle से model weights और tokenizer प्राप्त करें
- Kaggle के Gemma model page पर जाएँ और
Model Variations |> Gemma C++ चुनें
Variation dropdown में bfloat16 weights (उच्च fidelity) और 8-bit switched floating point weights (तेज़ inference) के विकल्प शामिल हैं
- आम तौर पर
-sfp checkpoint से शुरू करने की सिफारिश की जाती है
चरण 2: फ़ाइलें extract करें
- agreement भरने के बाद
archive.tar.gz फ़ाइल डाउनलोड करें और extract करें
- extracted files में model weights (उदाहरण:
2b-it-sfp.sbs) और tokenizer file (tokenizer.spm) शामिल होंगे
- आप इन files को किसी सुविधाजनक directory location पर ले जा सकते हैं (उदाहरण: इस repository की
build/ directory)
चरण 3: build
- build system CMake का उपयोग करता है
- gemma inference runtime को build करने के लिए build directory बनाएँ, और top-level project directory में
cmake का उपयोग करके build files generate करें
- 8-bit switched floating point weights (sfp) के लिए, बिना किसी option के cmake चलाएँ
- यदि आपने bfloat16 weights डाउनलोड किए हैं, तो ऊपर की तरह बिना option के cmake चलाने के बजाय, WEIGHT_TYPE को highway के
hwy::bfloat16_t type पर set करके cmake चलाएँ
- उपयुक्त
cmake command चलाने के बाद, build/ directory में जाएँ और make चलाकर ./gemma executable build करें
चरण 4: चलाएँ
build/ directory के भीतर gemma चलाया जा सकता है
gemma के लिए required arguments होते हैं, और उदाहरण के तौर पर इसे 2b-it-sfp.sbs weight file और tokenizer.spm tokenizer file के साथ चलाया जा सकता है
उपयोग
gemma में verbosity flag द्वारा नियंत्रित कई usage modes हैं
- सभी usage modes फिलहाल interactive हैं, और नई line input होने पर text generation trigger होता है
interactive terminal app
- default रूप से verbosity 1 पर set होती है, और
gemma invoke होने पर terminal-based interactive interface प्रदान करता है
command line tool के रूप में उपयोग
gemma executable को command line tool की तरह उपयोग करने के लिए, gemma.cpp के लिए पूरी तरह specified arguments वाला alias बनाना उपयोगी हो सकता है
अपने project में gemma.cpp library शामिल करें
- gemma.cpp को अपने project में शामिल करने का सबसे आसान तरीका
FetchContent का उपयोग करके gemma.cpp और उसकी dependencies को लाना है
- आप CMakeLists.txt में निम्न जोड़ सकते हैं
gemma.cpp को library के रूप में build करें
- gemma.cpp को अपने project में library dependency के रूप में उपयोग किया जा सकता है, और
libgemma target को build करके shared library artifact बनाया जा सकता है
आभार और संपर्क
- gemma.cpp की शुरुआत 2023 की शरद ऋतु में Austin Huang और Jan Wassenberg ने की थी, और Phil Culliton, Paul Chang, Dan Zheng के योगदान के साथ इसे फ़रवरी 2024 में जारी किया गया
- यह आधिकारिक रूप से supported Google product नहीं है।
GN⁺ की राय:
- gemma.cpp, large language models पर experimentation और research के लिए एक उपयोगी tool है, जो C++ आधारित हल्का inference engine प्रदान करके मौजूदा Python-केंद्रित frameworks के साथ मौजूद gap को कम करने में मदद करता है
- यह project open source community में योगदान का अवसर देता है और इस बात पर ज़ोर देता है कि Google के open source guidelines का पालन करना महत्वपूर्ण है
- gemma.cpp कई usage modes प्रदान करता है ताकि developers और researchers इसे अपने projects में आसानी से integrate और उपयोग कर सकें, और इसमें AI तथा ML क्षेत्र में innovation को बढ़ावा देने की क्षमता है
1 टिप्पणियां
Hacker News राय
Austin का परिचय और प्रोजेक्ट का विवरण:
Google की LLM प्रतिस्पर्धात्मकता पर राय:
build system पर सवाल:
Gemma के प्रदर्शन की सराहना:
LLM open source ecosystem की विकास गति पर आश्चर्य:
model format पर सवाल:
LLM की गणितीय क्षमता पर चर्चा:
Gemma में content restrictions को लेकर सवाल:
gemma.cpp के लिए आभार और भविष्य की सुविधाओं को लेकर उम्मीद:
Gemma मॉडल के executable file size पर सवाल: