¡Öllamafile¡×¤ÏÂ絬ÌϸÀ¸ì¥â¥Ç¥ë¤Î¥â¥Ç¥ë¤ä¥¦¥§¥¤¥È¤Î¾ðÊó¤¬1¤Ä¤Î¼Â¹Ô¥Õ¥¡¥¤¥ë¤Ë¤Þ¤È¤Þ¤Ã¤¿·Á¼°¤Î¥Õ¥¡¥¤¥ë¤Ç¤¹¡£Linux¡¦macOS¡¦Windows¡¦FreeBSD¡¦NetBSD¡¦OpenBSD¤È¤¤¤¦6¤Ä¤ÎOS¾å¤Ç¥¤¥ó¥¹¥È¡¼¥ëÉÔÍפÇÂ絬ÌϸÀ¸ì¥â¥Ç¥ë¤òÆ°ºî¤µ¤»¤ë¤³¤È¤¬²Äǽ¤È¤Î¤³¤È¤Ê¤Î¤Ç¡¢¼ÂºÝ¤ËWindows¤ª¤è¤ÓLinux¥Ç¥£¥¹¥È¥ê¥Ó¥å¡¼¥·¥ç¥ó¤Î1¤Ä¤Ç¤¢¤ëDebian¾å¤ÇÆ°¤«¤·¤Æ¤ß¤Þ¤·¤¿¡£

Mozilla-Ocho/llamafile: Distribute and run LLMs with a single file.

https://github.com/Mozilla-Ocho/llamafile#readme

Introducing llamafile - Mozilla Hacks - the Web developer blog

https://hacks.mozilla.org/2023/11/introducing-llamafile/

llamafile·Á¼°¤ÇÇÛÉÛ¤µ¤ì¤Æ¤¤¤ë¥â¥Ç¥ë¤Ï²¼µ­¤ÎÄ̤ꡣº£²ó¤Ï¤³¤Î¤¦¤Á¡¢²èÁü¤òǧ¼±¤Ç¤­¤ë¥â¥Ç¥ë¤Î¡ÖLLaVA 1.5¡×¤òÆ°ºî¤µ¤»¤Æ¤ß¤Þ¤¹¡£

ModelLicenseCommand-line llamafileServer llamafileMistral-7B-InstructApache 2.0mistral-7b-instruct-v0.1-Q4_K_M-main.llamafile (4.07 GB)mistral-7b-instruct-v0.1-Q4_K_M-server.llamafile (4.07 GB)LLaVA 1.5LLaMA 2(Ä󶡤ʤ·)llava-v1.5-7b-q4-server.llamafile (3.97 GB)WizardCoder-Python-13BLLaMA 2wizardcoder-python-13b-main.llamafile (7.33 GB)wizardcoder-python-13b-server.llamafile (7.33GB)

¢¡Windows¤ÇÆ°¤«¤·¤Æ¤ß¤¿

llava-v1.5¤Î¼Â¹Ô¥Õ¥¡¥¤¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤·¡¢Ì¾Á°¤òÊÔ½¸¤·¤ÆºÇ¸å¤Ë¡Ö.exe¡×¤ò²Ã¤¨¤Þ¤¹¡£



·Ù¹ð¤¬½Ð¤ë¤Î¤Ç¡Ö¤Ï¤¤¡×¤ò¥¯¥ê¥Ã¥¯¡£



¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ¼Â¹Ô¤¹¤ë¤ÈMicrosoft Defender SmartScreen¤Î²èÌ̤¬É½¼¨¤µ¤ì¤Þ¤¹¡£¡Ö¾ÜºÙ¾ðÊó¡×¤ò¥¯¥ê¥Ã¥¯¤·¤Þ¤¹¡£



¡Ö¼Â¹Ô¡×¥Ü¥¿¥ó¤¬½Ð¸½¤¹¤ë¤Î¤Ç¥¯¥ê¥Ã¥¯¤·¤Æ¼Â¹Ô¤·¤Þ¤¹¡£



̵»ö¥µ¡¼¥Ð¡¼¤¬µ¯Æ°¤·¤Æ¥Ö¥é¥¦¥¶¤¬¼«Æ°¤Ç³«¤­¡¢²¼¿Þ¤Î¤è¤¦¤Ëllama.cpp¤ÎUI¤¬½Ð¸½¤·¤Þ¤·¤¿¡£



º£²ó¤Ï²èÁü¤òǧ¼±¤Ç¤­¤ë¥â¥Ç¥ë¤ÎLlava¤ò»î¤¹¤È¤¤¤¦¤³¤È¤Ç¡¢²¼¤Î²èÁü¤ÎÀâÌÀ¤ò°ÍÍꤷ¤Æ¤ß¤Þ¤¹¡£



ºÇ²¼Éô¤Ë¤¢¤ë¡ÖUpload Image¡×¤ò¥¯¥ê¥Ã¥¯¤·¡¢²èÁü¤òÁªÂò¤·¤Æ¡Ö³«¤¯¡×¤ò¥¯¥ê¥Ã¥¯¡£



UI¤¬ÊѲ½¤·¤Ê¤¤¤¿¤áÀµ¤·¤¯¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤ë¤Î¤«É԰¤Ǥ¹¤¬¡¢¥Æ¥­¥¹¥È¤òÆþÎϤ·¤Æ¡ÖSend¡×¤ò¥¯¥ê¥Ã¥¯¤·¤Þ¤¹¡£



¤¹¤ë¤È²¼¿Þ¤Î¤è¤¦¤Ë²èÌ̤¬ÀÚ¤êÂؤï¤ê¡¢²èÁü¤È¥×¥í¥ó¥×¥È¤¬ÆþÎϤµ¤ì¤Þ¤·¤¿¡£



¿äÏÀÃæ¤ÎCPU»ÈÍÑΨ¤È¥á¥â¥ê»ÈÍÑÎ̤Ϥ³¤ó¤Ê´¶¤¸¡£CPU»ÈÍÑΨ¤Ï¹â¤¤Êª¤Î¥á¥â¥ê¤Î¾ÃÈñÎ̤Ϥۤܥ¼¥í¤Èɽ¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£



¾¤Î¥×¥í¥»¥¹¤È¤·¤Æɽ¼¨¤µ¤ì¤Æ¤¤¤ë¤Î¤«¤Ê¤È»×¤¤¤Þ¤·¤¿¤¬¡¢¥á¥â¥ê¤Î»ÈÍÑÎ̽ç¤ËʤÙÂؤ¨¤Æ¤ß¤Æ¤âÆäˤ½¤ì¤é¤·¤¤¥×¥í¥»¥¹¤Ï¤¢¤ê¤Þ¤»¤ó¤Ç¤·¤¿¡£



¤â¤Á¤í¤ó¥á¥â¥ê¤ò»È¤ï¤Ê¤¤¤ï¤±¤Ç¤Ï¤Ê¤¯¡¢PCÁ´ÂΤò¸«¤ë¤È¤Û¤Ü¾å¸Â¤Þ¤Ç¥á¥â¥ê¤¬»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤¹¡£



¿ôʬÄøÅ٤ǿäÏÀ¤¬´°Î»¡£¡ÖÆüËܸì¤Ç¡×¤È»ØÄꤹ¤ë¤³¤È¤ÇÆüËܸì¤Ç¤â½ÐÎϤ¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£Intel Core i7-8650U¥×¥í¥»¥Ã¥µ¡¼ÅëºÜ¤Î¥Î¡¼¥ÈPC¤ÇËèÉÃ3.33¥È¡¼¥¯¥ó¤Î®Å٤DzóÅú¤¬À¸À®¤µ¤ì¤Þ¤·¤¿¡£



llamafile¤ò½ªÎ»¤¹¤ë¤È¥á¥â¥ê¤Î»ÈÍÑÎ̤¬15.5GB¤«¤é9.5GB¤Ë¸º¾¯¤·¤¿¤Î¤Ç¡¢µÕ»»¤¹¤ë¤ÈºÇÂç¤ÇÌó6GB¤¬»ÈÍѤµ¤ì¤Æ¤¤¤¿ÌÏÍͤǤ·¤¿¡£



¢¡Debian¤ÇÆ°¤«¤·¤Æ¤ß¤¿

Google Cloud Platform¾å¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ÇÆ°ºî¤ò»î¤¹¤Î¤Ç¡¢¥³¥ó¥½¡¼¥ë¤Ë¥¢¥¯¥»¥¹¤·¤Æ¡ÖVM¤òºîÀ®¡×¤ò¥¯¥ê¥Ã¥¯¡£



̾Á°Íó¤Ë¡Ötest-llava¡×¤ÈÆþÎϤ·¡¢¥Þ¥·¥ó¤Î¹½À®¤ÇGPU¤òÁªÂò¤·¤Þ¤¹¡£º£²ó¤Ï16GB¤ÎVRAM¤òÅëºÜ¤·¤Æ¤¤¤ëNVIDIA T4¤ò»ÈÍѤ¹¤ë¤³¤È¤Ë¤·¤Þ¤·¤¿¡£



¥Þ¥·¥ó¥¿¥¤¥×¤Ï¡Ön1-standard-4¡×¤òÁªÂò¡£º£²ó¤Ï¥Æ¥¹¥ÈÍѤȤ¤¤¦¤³¤È¤Ç¡¢VM¥×¥í¥Ó¥¸¥ç¥Ë¥ó¥°¥â¥Ç¥ë¤Ï¡Ö¥¹¥Ý¥Ã¥È¡×¤Ë¤·¤Þ¤·¤¿¡£GCP¤ÎÅÔ¹ç¤ÇÆÍÁ³¥¤¥ó¥¹¥¿¥ó¥¹¤¬»ß¤Þ¤ë²ÄǽÀ­¤¬¤¢¤ë¤â¤Î¤Î¡¢ÎÁ¶â¤ò°Â¤¯ÍÞ¤¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£



NVIDIA CUDA¥¹¥¿¥Ã¥¯¤ò¼êÆ°¤Ç¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ëÂå¤ï¤ê¤Ë¥¤¥ó¥¹¥È¡¼¥ëºÑ¤ß¤Î¥¤¥á¡¼¥¸¤ò»ÈÍѤ·¤Æ¥Ö¡¼¥È¤¹¤ë¤Î¤Ç¡¢¡Ö¥¤¥á¡¼¥¸¤òÀÚ¤êÂؤ¨¡×¤ò¥¯¥ê¥Ã¥¯¤·¤Þ¤¹¡£



CUDA¤¬¥×¥ê¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¥¤¥á¡¼¥¸¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢¥Ç¥£¥¹¥¯¤Î¥µ¥¤¥º¤ò·è¤á¤Æ¡ÖÁªÂò¡×¤ò¥¯¥ê¥Ã¥¯¡£



²èÌ̲¼Éô¤Î¡ÖºîÀ®¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤·¤Þ¤¹¡£



¥¤¥ó¥¹¥¿¥ó¥¹¤¬µ¯Æ°¤·¤¿¤é¡ÖSSH¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¡£



ÊÌ¥¦¥£¥ó¥É¥¦¤¬³«¤­¡¢¥¤¥ó¥¹¥¿¥ó¥¹¤ËSSH¤ÇÀܳ¤Ç¤­¤Þ¤·¤¿¡£ºÇ½é¤ËNvidia¤Î¥É¥é¥¤¥Ð¤ò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤«Ê¹¤«¤ì¤ë¤Î¤Ç¡Öy¡×¤ÈÆþÎϤ·¤Æ¥¨¥ó¥¿¡¼¥­¡¼¤ò²¡¤·¤Þ¤¹¡£



²¼µ­¤Î¥³¥Þ¥ó¥É¤ÇLlava 1.5¤Îllamafile¤ò¥À¥¦¥ó¥í¡¼¥É¡£

wget https://huggingface.co/jartine/llava-v1.5-7B-GGUF/resolve/main/llamafile-server-0.1-llava-v1.5-7b-q4

¤½¤·¤Æ¼Â¹Ô¸¢¸Â¤òÉÕÍ¿¤·¤Þ¤¹¡£

chmod 755 llamafile-server-0.1-llava-v1.5-7b-q4

³¤¤¤Æ²¼µ­¤Î¥³¥Þ¥ó¥É¤Ç¼Â¹Ô¤·¤Þ¤¹¡£

./llamafile-server-0.1-llava-v1.5-7b-q4

µ¯Æ°¤¹¤ë¤È¥á¥â¥ê¤Ø¥â¥Ç¥ë¤¬¥í¡¼¥É¤µ¤ì¤Æ¤¤¤­¤Þ¤¹¡£½ÐÎϤµ¤ì¤ë¥í¥°¤ÎÃæ¤Ë¤ÏGPU¤Î¸ºß¤òǧ¼±¤·¤Æ¤¤¤½¤¦¤Ê¥í¥°¤â¸ºß¤·¤Æ¤¤¤Þ¤·¤¿¡£



¤·¤«¤·¡¢¥í¡¼¥É½ªÎ»¤ÈƱ»þ¤Ë¡Öcouldn't bind to server socket: hostname=127.0.0.1 port=8080¡×¤È¤¤¤¦¥¨¥é¡¼¤¬½Ð¤Æ½ªÎ»¤·¤Æ¤·¤Þ¤¤¤Þ¤·¤¿¡£´û¤Ë»ÈÍÑÃæ¤Î¥Ý¡¼¥È¤ò»È¤ª¤¦¤È¤·¤Æ¤·¤Þ¤Ã¤¿ÌÏÍÍ¡£



ÆâÉô¤Çllama.cpp¤¬Æ°ºî¤·¤Æ¤¤¤ë¤È¤Î¤³¤È¤Ê¤Î¤Ç¡¢llama.cpp¤Î¥É¥­¥å¥á¥ó¥È¤ò»²¹Í¤Ë¡Ö--port¡×¥ª¥×¥·¥ç¥ó¤ò¤Ä¤±¤ÆºÆÅټ¹Ԥ·¤Þ¤¹¡£

./llamafile-server-0.1-llava-v1.5-7b-q4 --port 8181

º£ÅÙ¤Ï̵»ö¤Ë¥µ¡¼¥Ð¡¼¤¬µ¯Æ°¤·¤Þ¤·¤¿¡£Windows¤Ç¹Ô¤Ã¤¿¤Î¤ÈƱÍͤβèÁü¡¦¥×¥í¥ó¥×¥È¤Ç¿äÏÀ¤ò¹Ô¤¤¤Þ¤¹¡£



¿äÏÀÃæ¤ÎCPU¤ÎÍͻҤò³Îǧ¤·¤Æ¤ß¤ë¤È²¼¿Þ¤ÎÄ̤ꡣ¥á¥â¥ê¤Î»ÈÍÑÎ̤Ï5.4GB¤ÇCPU»ÈÍÑΨ¤ÏÌó400¡ó¤Þ¤Ç¾å¾º¤·¤Æ¤¤¤Þ¤¹¡£



°ìÊýGPU¤Ï²¼¿Þ¤ÎÄ̤ê¾ÃÈñ¥á¥â¥ê2MB¤Ç¼Â¹ÔÃæ¤Î¥×¥í¥»¥¹¤â¸ºß¤»¤º¡¢CPU¤Î¤ß¤Ç¤Î¿äÏÀ¤È¤Ê¤Ã¤Æ¤¤¤Þ¤·¤¿¡£



GPU¤¬ÍøÍѤµ¤ì¤ë¾ò·ï¤òºÆ³Îǧ¤·¤Æ¤ß¤ë¤È¡¢¡Öcc¡×¤È¡Önvcc¡×¤¬É¬Íפǡ¢¤µ¤é¤Ë¡Ö--n-gpu-layers 35¡×¤È¤¤¤¦¥Õ¥é¥°¤òÉÕ¤±¤ëɬÍפ¬¤¢¤ë¤È¤Î¤³¤È¡£cc¤Ènvcc¤Ë¤Ä¤¤¤Æ¤Ï²¼¿Þ¤ÎÄ̤ê»ÈÍѲÄǽ¤Ê¾õÂ֤ˤʤäƤ¤¤Þ¤¹¡£



¡Ö--n-gpu-layers 35¡×¥Õ¥é¥°¤òÉÕ¤±¤Æ¤â¤¦°ìÅÙ¿äÏÀ¤ò¼Â¹Ô¤Ø¡£

./llamafile-server-0.1-llava-v1.5-7b-q4 --port 8181 --n-gpu-layers 35

¤È¤³¤í¤¬¡¢ÁêÊѤï¤é¤ºGPU¤¬»ÈÍѤµ¤ì¤Ê¤¤¾õÂ֤ΤޤޤȤʤäƤ·¤Þ¤¤¤Þ¤·¤¿¡£¡Ö²¿¤é¤«¤Î»ö¾ð¤ÇGPU¥µ¥Ý¡¼¥È¤ò¥³¥ó¥Ñ¥¤¥ë¤Ç¤­¤Ê¤¤¾ì¹ç¤ÏCPU¤Ç¤Î¿äÏÀ¤Ë¤Ê¤ë¡×¤Èµ­ºÜ¤µ¤ì¤Æ¤ª¤ê¡¢º£²ó¤Î¥Ñ¥¿¡¼¥ó¤Ï¤½¤Î¡Ö²¿¤é¤«¤Î»ö¾ð¡×¤òƧ¤ó¤Ç¤·¤Þ¤Ã¤¿¤è¤¦¤Ç¤·¤¿¡£



llamafile¤Î¥ê¥Ý¥¸¥È¥ê¤Ç¤Ï¡Ö¤É¤¦¤ä¤Ã¤ÆƱ»þ¤Ë¿¿ô¤Î¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ç¼Â¹Ô¤Ç¤­¤ë·Á¼°¤Î¼Â¹Ô¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤¿¤Î¤«¡×¤ällamafile·Á¼°¤Î¼Â¹Ô¥Õ¥¡¥¤¥ë¤ÎºîÀ®ÊýË¡¤Ê¤É¤¬²òÀ⤵¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢¶½Ì£¤Î¤¢¤ë¿Í¤Ï³Îǧ¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£