M2 Mac 㧠FlexGen ã使ã£ã¦ã¿ã
å½æã®ãã¨ãç¾ãã FlexGen ã Apple Silicon M2 ã® Mac ã§ä½¿ã£ã¦ã¿ããã¨æãã¾ã。
GitHub - FMInference/FlexGen: Throughput-oriented systems for large language models on commodity GPUs.
https://github.com/FMInference/FlexGen
ãã®æ å ±ã¯FlexGenãçºè¡¨ãããã°ããã®2023å¹´3æ10æ¥ç¾å¨ã®æ å ±ã§ãããã、éææ å ±ãã¢ãããã¼ããã¦ãã ãã。
è¿½è¨ : ä¸è¨ã®æ¹æ³ã§ããã®ãããããã§ã。
大è¦æ¨¡è¨èªã¢ãã«OPTãM1/M2 Macä¸ã®FlexGenã§åããã¦ãã£ãããã|ãã ãããã¤|note
1. å¿ è¦ç°å¢ãæ´ãã
※MacOS 13以ä¸ã§ã®å®æ½æ¨å¥¨。ããããå¤ãã¨torch.cumsum ã® MPS ãµãã¼ããç¡ãçºã§ã。
Pythonãã©ã¤ãã©ãªãæ¢ã«å ¥ã£ã¦ãã人ã¯ä»¥ä¸ã¯å¿ è¦ããã¾ãã。
1-1. python ã®ã¤ã³ã¹ãã¼ã«
Homebrewã§å
¥ããæ¹æ³ã§ããä»ã®æ¹æ³ã§ãæ§ãã¾ãã。
1-2. å¿ è¦ãªã©ã¤ãã©ãªã®ã¤ã³ã¹ãã¼ã«
pytorch (torch) ãã¤ã³ã¹ãã¼ã«ããã³ãã³ãã¯ä¸è¨ããåå¾ã㦠pip ã pip3 ã«å¤ãã¦ãã¾ã。
Start Locally | PyTorch
https://pytorch.org/get-started/locally/
PyTorch Build 㯠Stable ã§ã¯ãªã Preview (Nightly) ãé¸æãã¦ãã ãã。
2. ã¤ã³ã¹ãã¼ã«
3. 試ãã«å®è¡
ã³ãã³ããå®è¡ããã¨、ç´2.6GBã®ã¢ãã«ããã¦ã³ãã¼ãããã¾ã。
Macã®GPUãªã®ã§ mps (Metal Performance Shaders) ã§ã。
4. éãã§ã¿ã
ä»ã®äººã®ããã°ã¨ããè¦ãã¨ããã¯ãã® flexgen/apps/chatbot.py ããªã。
READMEã«ããã¯ãã®ãµã³ãã«ã³ã¼ããæ¶ãã¦ã。
ãªãã§?
Where is the chatbot? I miss it! · Issue #87 · FMInference/FlexGen https://github.com/FMInference/FlexGen/issues/87
çç±ã¯ãããã¾ããã chatbot.py ã¯æ¶ããã¦ãã¾ã£ãããã§ã。
éå»ã®ãã¡ã¤ã«ããåå¾ãã¦å®è¡ã§ããªãããª?
試ãã¦ã¿ã¾ããã、ä¸è¨ã¯ãã¡ã§ãã....
ãã㨠chatbot.py ã復活ããã¦ä¸ã¤é²åããã¦ãã ãã£ãæ¹ãçºè¦!!!
deepl ã®APIãã¼ãããã°æ¥æ¬èªã§ãåãããã«ãªã£ã¦ã¾ã!
æåãããã£ã¡ã§ããã°ããã£ã!
con3office/FlexGen at m1
https://github.com/con3office/FlexGen/tree/m1
ã¨ããããã§ä¸è¨ã³ãã³ãã§ç¡äºã«åä½ãã¾ãã。
åèã«ãããªã³ã¯
- FlexGenã§éãã ã¡ã¢|ãã¬|note
- FlexGen ã®ã¤ã³ã¹ãã¼ã«ã¨åä½ç¢ºèª(大è¦æ¨¡è¨èªã¢ãã«,ãã£ããããã)(Python,PyTorch ã使ç¨)(Windows ä¸)
- 大è¦æ¨¡è¨èªã¢ãã«OPTãM1/M2 Macä¸ã®FlexGenã§åããã¦ãã£ãããã|ãã ãããã¤|note
- PyTorchãApple Siliconã®GPUã使ããããã«ãªããããã®ã§è©¦ãã¦ã¿ã - Qiita
- PyTorchãM1 MacBook ã®GPU(MPS)ã§åãã.å®è¡æéã®æ¤è¨¼ãããã
ã³ã¡ã³ã