chainer-compilerã®ãã®å¾ Shinichiro Hamaji
chainer-compilerã®ãã®å¾ Shinichiro Hamaji
â»ãã®è¨äºã¯Chainer Blogã®æ訳ã§ã Chainer ã«ãã«ããã¼ãã§ã®åæ£å¦ç¿æ©è½ã追å ããããã±ã¼ã¸ã§ããChainerMN ã«ããããã¯ã¼ã¯ã¹ã«ã¼ããããä½ãã·ã¹ãã åãã®ä»¥ä¸ã®2ã¤ã®æ©è½ãv1.2.0ã¨v1.3.0ã§è¿½å ãã¾ããã Double bufferingã«ããéä¿¡æéã®é ãºãæ©è½ å精度浮åå°æ°ç¹æ°(FP16)ã«ããAll-Reduceæ©è½ ChainerMNã¯é«éãªãããã¯ã¼ã¯ãæã¤ã¹ã¼ãã¼ã³ã³ãã¥ã¼ã¿ãMicrosoft Azureã®ãããªã·ã¹ãã ãæ³å®ãã¦éçºãã¦ãããããé«éãªãããã¯ã¼ã¯ã®ãªãç°å¢ã§ã¯é«ã並åæ§è½ãéæããã®ãé£ããã¨ããåé¡ãããã¾ããããããããããã®æ©è½ã使ããã¨ã§ãGTC2018ã§çºè¡¨ããããã«Amazon Web Services (AWS)ã®ãããªä¸è¬çãªã·ã¹ãã ã§ãChainerMNã«ãã£ã¦é«ã並åæ§è½ãéæãããã¨ãã§ã
æ¬è¨äºã¯ã2017å¹´ã¤ã³ã¿ã¼ã³ã·ãããçµã¦ç¾å¨ã¯ã¢ã«ãã¤ãã¨ãã¦å¤åããã¦ããä¸éããã«ããå¯ç¨¿ã§ã æ°å¼ãæ£ãã表示ãããªãå ´åã¯ããã¡ãã®ãªã³ã¯ããåèªè¾¼ãã試ããã ããã ã¿ãªããã¯ããã¾ãã¦ãPreferred Networksã®2017å¤å£ã¤ã³ã¿ã¼ã³ã«åå ããç¾å¨ã¢ã«ãã¤ãããã¦ããä¸éè£ä¸éã§ããæ®æ®µã¯æ±äº¬å·¥æ¥å¤§å¦ã§High-Performance Computingã«é¢ããç 究ãè¡ã£ã¦ãããåæ£ã»ä¸¦åè¨ç®ã«èå³ãããã¾ãã ä»åã¯ãåæ£æ·±å±¤å¦ç¿ãè¡ãéã«ä½¿ç¨ãããAllReduceã¨ããéä¿¡ãã¿ã¼ã³ã«ã¤ãã¦èª¿æ»ã»å®è£ ã»è©ä¾¡ãè¡ãã¾ããã®ã§ãããã«ã¤ãã¦ã説æãããã¾ãã åæ£æ·±å±¤å¦ç¿ã¨ã¯ ç¾å¨ããã£ã¼ããã¥ã¼ã©ã«ãããã¯ã¼ã¯ãç¨ããå¦ç¿ã«ã¯é·ãæéãããããã¨ãç¥ããã¦ãã¾ããããã¦ãæ§ã ãªç¨®é¡ã®ã¢ãã«ãã大éã®ãã¼ã¿ãçµã¿åããã¦å¦ç¿ã試ãããã«ã¯ãå¦ç¿ã«ãããæéãç縮ã
Chainer ãã¥ã¼ããªã¢ã« æ°å¦ã®åºç¤ãããã°ã©ãã³ã°è¨èª Python ã®åºç¤ãããæ©æ¢°å¦ç¿ã»ãã£ã¼ãã©ã¼ãã³ã°ã®çè«ã®åºç¤ã¨ã³ã¼ãã£ã³ã°ã¾ã§ãå¹ åºã解説 â»Chainerã®éçºã¯ã¡ã³ããã³ã¹ã¢ã¼ãã«å ¥ãã¾ããã詳ããã¯ãã¡ããã覧ãã ããã ä½ããå¦ã¶ã¹ããè¿·ããªã ãã£ã¼ãã©ã¼ãã³ã°ãå¦ã¶ã«ã¯ã大å¦ã§å¦ã¶ã¬ãã«ã®æ°å¦ã Python ã«ããããã°ã©ãã³ã°ã®ç¥èã«å ãã¦ã Chainer ã®ãããªãã£ã¼ãã©ã¼ãã³ã°ãã¬ã¼ã ã¯ã¼ã¯ã®ä½¿ãæ¹ã¾ã§ãå¹ åºãç¥èãå¿ è¦ã¨ãªãã¾ãã æ¬ãã¥ã¼ããªã¢ã«ã¯ãåå¦è ã«ãããããã¾ãä½ãå¦ã¹ã°è¯ããããåãããªãã ã¨ããåé¡ã解決ããããã«è¨è¨ããã¾ããã åå¦è ã¯ãã¾ãä½ããããã¦ã次ã«ä½ããã¨è¿·ããã¨ãªããå¿ è¦ãªç¥èãé çªã«å¦ç¿ã§ãã¾ãã åæç¥èãã解説 ãã®ãã¥ã¼ããªã¢ã«ã¯ãChainer ãªã©ã®ãã£ã¼ãã©ã¼ãã³ã°ãã¬ã¼ã ã¯ã¼ã¯ã使ã£ãããã°
ã¯ããã« Chainer 4ããiDeepãæ£å¼ã«ãµãã¼ããããããã«ãªãã¾ãããiDeepã使ããã¨ã§CPUã«ããå¦ç¿ã»æ¨è«ãé«éã«ãªãã¾ãããã¡ãããiDeepã¯Xeonç³»ã®CPUã主ãªã¿ã¼ã²ããã¨ãã¦ãã¾ãããçµé¨ä¸ãã¼ãPCã¬ãã«ã§ãå¤å°ã®é度åä¸ãããã¾ãã iDeepã®æ´»ç¨æ¹æ³ã«ã¤ãã¦èª¬æããã¦ã§ããµã¤ãã¯ããã¤ãããã®ã§ãããå°å ¥ãMKLã®ã¤ã³ã¹ãã¼ã«ããéãã§èª¬æãã¦ãããµã¤ãããªãã£ãã®ã§ãåå¿é²ã®ããã«iDeepã®å°å ¥æ¹æ³ãè¨è¼ãã¾ãã ãªããæ¬èª¬æã¯Ubuntu 16.04ãChainer 5.0.0rc1ã対象ã«ãã¦ãã¾ããiDeepãChainerã®APIã¯ä»å¾ã©ãã©ãããã£ã¦ããã¨æãããã®ã§ãé©å®ã½ã¼ã¹ã®ãµã¤ããåç §ãã¦ãã ããã æé Pythonã®å°å ¥ é©å½ãªæ¹æ³ã§Pythonã使ããç°å¢ãä½ãã¾ãããã®ã¨ããPythonã®shared objectãå¿ã
èªåã¸ã®åå¿é²çãªæå³ãè¾¼ãã¦æè¿ã¾ã¨ããã®ã§ãç§ãå®è·µãã¦ããChainer/ChainerMNã®ãããã¡ã¤ã«ã®åãæ¹ã¨ãããã¡ã¤ã«çµæã®è¦æ¹ãç´¹ä»ãã¾ãã ãã®è¨äºã§ä½¿ããããã¡ã¤ã©ã¯ãChainerã®ãããã¡ã¤ã«ãåãéã¾ãåãã¹ãã¨æãããcProfileã¨nvprofã®äºã¤ã§ãã ç°å¢ Python: 3.6 Chainer: 5.2 CuPy: 5.2 CUDA: 9.0 MPI:ãOpenMPI 1.10.7 åèã³ã¼ã ãã®è¨äºã§ã¯ChainerMNã®mnistã®ãµã³ãã«ããã¼ã¹ã«æ¹é ããã³ã¼ãã§èª¬æãè¡ã£ã¦ãã¾ãã mnistã®ãªãªã¸ãã«ã®ã³ã¼ãã¯ãã¡ãã https://github.com/chainer/chainer/blob/v5/examples/chainermn/mnist/train_mnist.py æ¹è¯å¾ã®ã³ã¼ãã¯ããã«ä¸ãã¦ããã¾ãã https:
ä»æ¥ãã Chainer-compiler ã«ã¤ãã¦èª¿ã¹ã¦ã¿ããã DeepLearning ã³ã³ãã¤ã©ãå æ¥ã®FPGAXã§ã話é¡ã«ãªã£ã¦ã¾ãããï¼ãªã¢ã¼ãã§ã¡ãã£ã¨è¦ã¦ã¾ããï¼ PFN ããã® release ã¯ãã Chainer ã¢ãã«ã®ãããªãé«éåããããã¤ã®ç°¡ä¾¿åãå¯æ¬æ§ã®åä¸ã«åããå®é¨çãªåãçµã¿ã«ã¤ã㦠| Preferred Research ä»æ¥è¦ãã½ã¼ã¹ã¨ãã¼ã¸ã§ã³ã¯ãããexperimental ãªç¹æ³¨æã pfnet-research/chainer-compiler at 1c788abbaf5fc74533d332b3141d5a141b6db020 https://github.com/pfnet-research/chainer-compiler/tree/1c788abbaf5fc74533d332b3141d5a141b6db020 README ã
PFN ã®ã¨ã³ã¸ãã¢ã®æµå°ã§ããå ¥ç¤¾ä»¥æ¥åãçµãã§ããå®é¨çãªããã¸ã§ã¯ã Chainer-compiler ã github ã§å ¬éãã¾ãããã¾ã å®éç¨ã«æå ¥ãã¦ããã段éã§ã¯ç¡ãã§ãããé¢ç½ããã®ã«ãªã£ã¦ãã¦ããã®ã§ã¯ãªããã¨æãã®ã§ãç´¹ä»ããã¦ãããããã¨æãã¾ãã https://github.com/pfnet-research/chainer-compiler æ¨å¹´æ«ã PFN 㯠ChainerX ããã¼ã¿ãªãªã¼ã¹ãã¾ããã ChainerX 㯠Chainer ã®ä½¿ãããããç¶æãã¤ã¤ã Python ã§å®è£ ããã¦ããé¨åã C++ å®è£ ã§ç½®ãæãã以ä¸ã®3ã¤ãå®ç¾ãããã®ã§ããã ã¢ãã«ã®å®è¡ãé«éåãã Python ã®ç¡ãç°å¢ã§ããããã¤å¯è½ã«ãã CPU/GPU以å¤ã¸ã®ç§»æ¤ã容æã«ãã Chainer-compiler ããã¸ã§ã¯ã㯠ChainerX ãå©ç¨ãã¦ã
News¶ 2019/12/06: è¬ç¾©è³æVer 1.1ãå ¬éï¼2019年度çï¼ 2018/12/17: è¬ç¾©è³æVer 1.0ãå ¬éï¼2018年度çï¼ æ¬è¬ç¾©è³æã«ã¤ãã¦Â¶ æ¬ãã¼ã¸ã¯ æ¥æ¬ã¡ãã£ã«ã«AIå¦ä¼å ¬èªè³æ ¼ï¼ã¡ãã£ã«ã«AIå°éã³ã¼ã¹ã®ãªã³ã©ã¤ã³è¬ç¾©è³æï¼ä»¥ä¸æ¬è³æï¼ ã§ãï¼ æ¬è¬æãèªããã¨ã§ï¼å»çã§äººå·¥ç¥è½æè¡ã使ãéã«æä½éå¿ è¦ãªç¥èãå®è·µæ¹æ³ãå¦ã¶ãã¨ãã§ãã¾ãï¼æ¬è³æã¯å ¨ã¦Google Colaboratoryã¨ãããµã¼ãã¹ãç¨ãã¦å·çããã¦ããï¼åç« ã¯Jupyter notebook (iPython notebook)ã®å½¢å¼ï¼.ipynbï¼ã§ä»¥ä¸ã®ãªãã¸ããªã«ã¦é å¸ããã¦ãã¾ãï¼notebooksãã£ã¬ã¯ããªä»¥ä¸ã«å ¨ã¦ã®.ipynbãã¡ã¤ã«ãå ¥ã£ã¦ãã¾ãï¼ï¼ japan-medical-ai/medical-ai-course-materials æ³å®åè¬è ¶ å
ãã¤ãã¼ãã©ã¡ã¼ã¿èªåæé©åãã¬ã¼ã ã¯ã¼ã¯ãOptunaãã®ãã¼ã¿çã OSS ã¨ãã¦å ¬éãã¾ããããã®è¨äºã§ã¯ãOptuna ã®éçºã«è³ã£ãåæ©ãç¹å¾´ãç´¹ä»ãã¾ãã å ¬å¼ãã¼ã¸ å ¬å¼ããã¥ã¡ã³ã ãã¥ã¼ããªã¢ã« GitHub ãã¤ãã¼ãã©ã¡ã¼ã¿ã¨ã¯ï¼ ãã¤ãã¼ãã©ã¡ã¼ã¿ã¨ã¯ãæ©æ¢°å¦ç¿ã¢ã«ã´ãªãºã ã®æåãå¶å¾¡ãããã©ã¡ã¼ã¿ã®ãã¨ã§ããç¹ã«æ·±å±¤å¦ç¿ã§ã¯å¾é æ³ã«ãã£ã¦æé©åã§ããªãã»ããªããã©ã¡ã¼ã¿ã«ç¸å½ãã¾ããä¾ãã°ãå¦ç¿çãããããµã¤ãºãå¦ç¿ã¤ãã¬ã¼ã·ã§ã³æ°ã¨ãã£ããããªãã®ããã¤ãã¼ãã©ã¡ã¼ã¿ã¨ãªãã¾ããã¾ãããã¥ã¼ã©ã«ãããã¯ã¼ã¯ã®å±¤æ°ããã£ã³ãã«æ°ã¨ãã£ããããªãã®ããã¤ãã¼ãã©ã¡ã¼ã¿ã§ããæ´ã«ããã®ãããªæ°å¤ã ãã§ãªããå¦ç¿ã« Momentum SGD ãç¨ãããããã¨ã Adam ãç¨ããããã¨ãã£ããããªé¸æããã¤ãã¼ãã©ã¡ã¼ã¿ã¨è¨ãã¾ãã ãã¤ãã¼ãã©ã¡ã¼ã¿ã®èª¿æ´ã¯æ©æ¢°å¦ç¿ã¢
æµ·æ´ã®çç©éã®æ¨å®ãããã¨ãã«ã¯ãå®éã«ãã空éã®ç¨®ãã¨ã®åä½æ°ã1å¹1å¹æ°ããããã«ã¯ããã¾ãããããã§ãæ°´ä¸ã«æ®ã£ãçç©ã®ç´°èã®DNAããªãã¡ç°å¢DNAã®å¯åº¦ãæãããã«ãã¦æ¨è¨ãããã®ã ããã§ãï¼ãã±ãä¸æ¯ã®æ°´ã§æµ·æ´çç©ã®éã種é¡ãç¥ãï¼ã Chainerã§æ¸ããNNã¨ããã¼å ¥åãããã¨ãããã®NNã®forward passã®çè«çãªè¨ç®éã»ã¡ã¢ãªè»¢ééãè¨ç®ããchainer_computational_costãä½ãã¾ããã Chainerã®Function Hookããã¼ã¹ã«ãã¦ãããããNNã®å®ç¾©ã³ã¼ãã«æãå ¥ããå¿ è¦ã¯ä¸åããã¾ããã èæ¯ TL;DR éé²ã«è»½ãNNãæ¢ãããå®éçã§æ°è»½ã«ä½¿ããææ¨ãããæ¹ãããã§ãããã¨ãã話ã§ãã ãã¥ã¼ã©ã«ãããæè¡ã®å®ç¨åãé²ãä¸ã§ããã«ç²¾åº¦ãä¿ã¡ãªãã軽ãã¢ã¼ããã¯ãã£ãæ¢ããã¯ã¨ã¦ãéè¦ã§ããæåã«ããèªåã«ãããåºæ¬çã«ã¯è¨
ã2018å¹´9æ14æ¥ãGTC Japanè¬æ¼è³æã Chainer ã¯ãç´æçãªè¨è¿°ãç¹å¾´ã®æ·±å±¤å¦ç¿ãã¬ã¼ã ã¯ã¼ã¯ã§ããDefine-by-Run æ¹å¼ã«ãããã¥ã¼ã©ã« ãããã®è¨ç®éç¨ããã®ã¾ã¾ Python ã§æ¸ãä¸ããCuPy ã cuDNN ãç¨ãããã¨ã§ GPU ã®è¨ç®åãæ大éå¼ãåºããã¨ãã§ãã¾ããChainer ãç¨ãã深層å¦ç¿ã®ããã©ã¼ãã³ã¹ç¹æ§ãé«éåã®ææ³ãããã©ã¼ãã³ã¹åä¸ã®åãçµã¿ãªã©ããç´¹ä»ãã¾ãã
Chainer 4.0 + iDeepã§ç°¡åã«ããã©ã¼ãã³ã¹æ¸¬å®ãããã¨ããããªããªããããã£ãã®ã§ãã¡ã¢ã§ãã ãã£ãããªã®ã§ãGoogle Cloud Platform(GCP)ã®Alway freeã®ã¤ã³ã¹ã¿ã³ã¹ãf1-microã§åããã¦ã¿ã¦ãããã©ã¼ãã³ã¹ãæ¯è¼ãã¦ã¿ã¾ãããï¼å®ãã¤ã³ã¹ã¿ã³ã¹ã§ãéããªãã¨ããã®ã確èªãããã£ãã®ã§ï¼ åèï¼ pip 㧠MKL ã«ãªã³ã¯ããã numpy, scipy ãèªåçã«ã¤ã³ã¹ãã¼ã«ãããããã«ãã iDeep ã使ã£ã¦CPUã§ã®Chainerã®æ¨è«é度ãã¢ããããã ã¤ã³ã¹ãã¼ã«æ¹æ³ 以ä¸ãUbuntu 17.10 ã«å ¥ãã¦ãã¾ãã https://software.intel.com/en-us/mkl ããã"Intel Math Kernel Library"ããã¦ã³ãã¼ã æ¢åã® chainerãnumpy ãã¢ã³ã¤ã³ã¹ãã¼ã«
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}