MicrosoftããBitNetã®Llama 8Bçãå ¬éããããCPUã®ã¿ã§çéã§åããã¨ãç¹å¾´ãGPUãä¸è¦ãªã®ã§çã¨ãã«ãªãããã¢ãã¤ã«ç«¯æ«ã§ã使ããããã«ãªããã¨ãæå¾ ã§ããããããæãï¼ï¼ï¼ï¼ãã«PCã§ãåãã®ã試ãã¦ã¿ãã
Â
å°å ¥æ¹æ³
å°å ¥å ç°å¢ã¯Ubuntu 22.04ã§ãããã½ã¼ã¹ã¯ãã¡ãã®ãã¼ã¸ã«ããã
Â
å°å ¥æ¹æ³ã¯ä¸è¨ãã¼ã¸ã®READMEã®éãã§ããããç§ã¯ä¸è¨ã®ãã¼ã¸ãåèã«ããã
Mervin Praison - Site Reliability Engineer
Â
condaã³ãã³ãã®å°å ¥ãªã©èªåã®ç°å¢ã§è¿½å ã§å¿ è¦ã«ãªã£ãæé ãå«ãã¦ä»¥ä¸ã«ã¡ã¢ããã
- System Updates and Dependencies
ã·ã¹ãã ã®æ´æ°ã¨å¿ é ã½ããã®å°å ¥
$ sudo apt update $ sudo apt upgrade $ sudo apt-get update $ sudo apt-get install -y build-essential $ sudo apt-get install -y libstdc++-12-dev $ sudo apt-get install -y clang llvm $ sudo apt-get install -y libc++-dev libc++abi-dev $ sudo apt-get install -y llvm-14 llvm-14-dev $ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
minicondaã®å°å ¥$ mkdir -p ~/miniconda3 $ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh $ bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
- Conda Environment Setup
baseç°å¢ãèµ·åãã
$ source ~/miniconda3/bin/activate (base)$
baseç°å¢ã®èµ·åã確èªããbinnet-cppç°å¢ãæ§ç¯ãèµ·åãã(base)$ conda create -n bitnet-cpp python=3.9 -y (base)$ conda activate bitnet-cpp (bitnet-cpp)$
- Clone Repository
bitnet-cppç°å¢ã«ã¬ãã¸ããªãã¯ãã¼ã³ãã(bitnet-cpp)$ sudo apt install git (bitnet-cpp)$ git clone --recursive https://github.com/microsoft/BitNet.git (bitnet-cpp)$ cd BitNet
- Python Dependencies
bitnet-cppç°å¢ã«Pythonã®å¿ è¦ãªã¢ã¸ã¥ã¼ã«ãå°å ¥ãã(bitnet-cpp)~/BitNet$ pip install -r requirements.txt (bitnet-cpp)~/BitNet$ pip install cmake
- Build the projectï¼ã©ã¡ããã§è¡ãï¼
ã¢ãã«ã®ãã¦ã³ãã¼ããGGUFå¤æãããã¸ã§ã¯ãã®ãã«ããè¡ã
(bitnet-cpp)~/BitNet$ python setup_env.py --hf-repo HF1BitLLM/Llama3-8B-1.58-100B-tokens -q i2_s
ã¾ãã¯ãã¢ãã«ã®ãã¦ã³ãã¼ãã¨ãGGUFå¤æãããã¸ã§ã¯ãã®ãã«ããåãã¦è¡ã
(bitnet-cpp)~/BitNet$ huggingface-cli download HF1BitLLM/Llama3-8B-1.58-100B-tokens --local-dir models/Llama3-8B-1.58-100B-tokens (bitnet-cpp)~/BitNet$ python setup_env.py -md models/Llama3-8B-1.58-100B-tokens -q i2_s
- Run Inference
æ¨è«ã®å®è¡(bitnet-cpp)~/BitNet$ python run_inference.py -m models/Llama3-8B-1.58-100B-tokens/ggml-model-i2_s.gguf -p "Daniel went back to the the the garden. Mary travelled to the kitchen. Sandra journeyed to the kitchen. Sandra went to the hallway. John went to the bedroom. Mary went back to the garden. Where is Mary?\nAnswer:" -n 6 -temp 0
Â
åä½ç¢ºèª
ä¸è¨ã®ããã©ã«ããµã³ãã«ãå®è¡ãããæãã質åã¨åçã¯ä»¥ä¸ã®éãã
Daniel went back to the the the garden. Mary travelled to the kitchen. Sandra journeyed to the kitchen. Sandra went to the hallway. John went to the bedroom. Mary went back to the garden. Where is Mary?
Mary is in the garden.
æ£è§£ãæ£å¸¸ã«åä½ãã¦ããããã ã
Â
æ§è½ãã¹ã
æ§è½ã¨è¨ã£ã¦ããåçé度ãæ©ãã®ã¯ééããªããããªã®ã§ãè³¢ãã®ç¨åº¦ããã¹ããã¦ã¿ãã
ã¹ããããªã¼åé¡
How many r in strawberry?ãï¼"starawberry"ã«"r"ã¯ããã¤ããã¾ããï¼ï¼
 1.5 millionï¼150ä¸ã§ãï¼
ã¸ã§ã¼ã¯ã®ã¤ããã ãããï¼ð ãå ¨ãäºæ³å¤ã®åçã ã£ãã
å æ°å解
Factorize 6x^2+x-12.ãï¼6x^2+x-12ãå æ°å解ãã¦ï¼
èµ·åæã®ãã©ã¡ã¼ã¿ï¼-nï¼ã§åçã®ãã¼ã¯ã³æ°ã128ã«æå®ããã
The answer is (3,4).Step by Step Solution:We will solve the problem in two steps. In first step we have to find out GCF of both numbers and then multiply it with each number separately so that you get a common factor for all terms which are multiplied together at last stage
GCD = 2x1+3, So,Multiply by (4) on left side.(6)(8)=48. Multiply the right hand sides also in same way to find GCF of both numbers and then multiply it with each number separately so that you get a common factor for all terms which are multiplied together atçã㯠(3,4) ã§ããã¹ããããã¤ã¹ãããã®è§£æ±ºæ³: åé¡ã 2 ã¤ã®ã¹ãããã§è§£ãã¾ããæåã®ã¹ãããã§ã¯ã両æ¹ã®æ°å¤ã®æå¤§å ¬ç´æ°ãæ±ãããããåæ°å¤ã¨å¥ã ã«æãã¦ãæå¾ã®æ®µéã§æãåãããããã¹ã¦ã®é ã®å ±éå æ°ãå¾ã¾ãã
GCD = 2x1+3 ãªã®ã§ãå·¦å´ã« (4) ãæãã¾ãã(6)(8)=48ãå³å´ãåæ§ã«æãã¦ã両æ¹ã®æ°å¤ã®æå¤§å ¬ç´æ°ãæ±ãããããåæ°å¤ã¨å¥ã ã«æãã¦ãæå¾ã®æ®µéã§æãåãããããã¹ã¦ã®é ã®å ±éå æ°ãå¾ã¾ãã
æ£è§£ã¯ï¼3x-4ï¼ï¼2x+3ï¼ãé常ã®Llama3 8Bã¯ééãããã¨ãããããããå°ãã¾ã¨ããªåçããã¦ãããã®ã ããBitNetã§éååãããã¨ã§è³¢ãã¯å£åãã¦ããããã«è¦ããã
Â
å²å¦çåé¡
What is the meaning of life?ãï¼äººçã®æå³ã¨ã¯ä½ãï¼ï¼
The meaning of life is to be happy and to be useful to others.ãï¼äººçã®æå³ã¯å¹¸ãã«ãªããã¨ã¨ä»äººã®å½¹ã«ç«ã¤ãã¨ã§ããï¼
Question: What is the meaning of life?
Answer: The meaning of life is to be happy and to be useful to others.
Question: What is the meaning of life?
Answer: The meaning of life is to be happy and to be useful to others.
Question: What is the meaning of life?
Answer: The meaning of life is to be happy and to be useful to others.
Question: What is the meaning of life?
Answer: The meaning of life is to be happy and to be useful to others.
Question: What is the meaning of life?
ãã©ã¡ã¼ã¿ï¼-nï¼ã§åçã®ãã¼ã¯ã³æ°ã128ã«æå®ããã¨ãããåã質åã¨åçãèªåã§ç¹°ãè¿ãåçã«ãªã£ãã
åçãç¹°ãè¿ãæåã調æ´ããã«ã¯ãrun_inference.pyå ã§llama-cliãèµ·åãããã©ã¡ã¼ã¿ã«ã--repeat-penaltyãã追å ãã¦é«ãã®å¤ã«ãããï¼ããã©ã«ãã¯1.0ï¼
試ãã«ã--repeat-penalty 15.0ãã¨ãã¦å®è¡ããã¨ç¹°ãè¿ãã¯æ¹åãããããããæºè¶³ã§ããåçã¯å¾ãããªãã£ãã
Â
ã¹ããããªã¼åé¡ï¼ãã®ï¼ï¼
BitNeté¢é£ã®Youtubeã®åç»ãè¦ãã¨ã質åæãå°ãå¤æ´ãããã¨ã§æ£è§£ã§ãããããªã®ã§è©¦ãã¦ã¿ãã
How many R's in strawberry?
There are 3 letters,R in the word "strawberry".
確ãã«æ£è§£ãã¦ããããã質åã®ä»æ¹ã§åçã大ããå¤ããããã§ã¯å°ãã
Â
ææ³
BitNetã¯åãçµãã¢ã¤ãã¢ã¨ãã¦ã¯ç´ æ´ããããããããåå ãã©ãã«ããã®ãã¯åãããªãããæ§è½ï¼è³¢ãï¼ã®å£åãããã¨æãããã質åã®ä»æ¹ãè¨å®ãã©ã¡ã¼ã¿ã«ãã£ã¦åçã大ããå¤ããç¹ãå°ããå¿åº¦ãªãã§è¨ããã¦ãããã¨ãå®ç¨é¢ã§ã¯ã¾ã åé¡ãããã¨æãã
Â