{"id":3448,"date":"2024-12-31T10:00:45","date_gmt":"2024-12-31T01:00:45","guid":{"rendered":"https:\/\/comcent.co.jp\/blog\/?p=3448"},"modified":"2024-09-24T15:31:58","modified_gmt":"2024-09-24T06:31:58","slug":"%e5%a4%a7%e8%a6%8f%e6%a8%a1%e8%a8%80%e8%aa%9e%e3%83%a2%e3%83%87%e3%83%ab%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%83%ad%e3%83%bc%e3%82%ab%e3%83%ab%e3%81%a7%e5%8b%95%e4%bd%9c%e3%81%99%e3%82%8bai","status":"publish","type":"post","link":"https:\/\/comcent.co.jp\/blog\/archives\/3448\/","title":{"rendered":"\u5927\u898f\u6a21\u8a00\u8a9e\u30e2\u30c7\u30eb\u3092\u5229\u7528\u3057\u3066\u30ed\u30fc\u30ab\u30eb\u3067\u52d5\u4f5c\u3059\u308bAIChatBot\u3092\u4f5c\u6210\u3059\u308b"},"content":{"rendered":"\n<p><h2 class=\"pageBlogLTitle\">\u8a00\u8a9e\u30e2\u30c7\u30eb\u3068\u306f<\/h2>\n<p>\u305d\u3082\u305d\u3082\u8a00\u8a9e\u30e2\u30c7\u30eb\u3068\u306f\u3001ChatGPT\u306b\u4ee3\u8868\u3055\u308c\u308b\u3001\u30c6\u30ad\u30b9\u30c8\u3092\u5165\u529b\u3059\u308b\u3068\u3001\u305d\u308c\u306b\u5bfe\u3059\u308b\u59a5\u5f53\u306a\u8fd4\u7b54\u3092\u8fd4\u3059AI\u6280\u8853\u306e\u4e2d\u6838\u3068\u306a\u308b\u3082\u306e\u3067\u3001\u5404\u5358\u8a9e\u306a\u3069\u306e\u7e4b\u304c\u308a\u3084\u610f\u5473\u7684\u306b\u8fd1\u3044\u304b\u3069\u3046\u304b\u306a\u3069\u3092\u6570\u5b66\u7684\u306b\u8868\u3057\u305f\u3082\u306e\u3092\u96c6\u5408\u3055\u305b\u305f\u3082\u306e\u3067\u3059\u3002\u3053\u306e\u30e2\u30c7\u30eb\u306f\u57fa\u672c\u7684\u306b\u7fd2\u5f97\u3055\u305b\u3066\u3044\u308b\u5358\u8a9e\u306e\u6570\u3084\u7e4b\u304c\u308a\u60c5\u5831\u306e\u6570\u304c\u5897\u3048\u308c\u3070\u3001\u7cbe\u5ea6\u304c\u9ad8\u304f\u306a\u308b\u3068\u8a00\u3046\u306e\u306f\u4f55\u3068\u306a\u304f\u60f3\u50cf\u304c\u4ed8\u304f\u3068\u601d\u3044\u307e\u3059\u3002\u77e5\u3089\u306a\u3044\u5358\u8a9e\u304c\u591a\u3059\u304e\u3066\u306f\u7b54\u3048\u3088\u3046\u3082\u7121\u3044\u3067\u3059\u304b\u3089\u3002<\/p><\/p>\n\n\n\n<p>\u3053\u306e\u8a00\u8a9e\u30e2\u30c7\u30eb\u306e\u3046\u3061\u3001\u5358\u8a9e\u6570\u3084\u7e4b\u304c\u308a\u60c5\u5831\u306e\u6570\uff08\u30d1\u30e9\u30e1\u30fc\u30bf\u6570\uff09\u3092\u7269\u51c4\u304f\u81a8\u5927\u306b\u3057\u305f\u3082\u306e\u304c\u5927\u898f\u6a21\u8a00\u8a9e\u30e2\u30c7\u30eb\u3068\u3055\u308c\u3066\u3044\u3066\u3001\u6982\u306d70\u5104\u4ee5\u4e0a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304b\u3089\u69cb\u6210\u3055\u308c\u3066\u3044\u308b\u3082\u306e\u3092\u5927\u898f\u6a21\u8a00\u8a9e\u30e2\u30c7\u30eb\uff08LLM\uff09\u3068\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3088\u3046\u306b\u601d\u3044\u307e\u3059\u3002<br>\u975e\u5e38\u306b\u3088\u304f\u4f7f\u308f\u308c\u3066\u3044\u308bChatGPT\u306f\u30013.5\u306e\u6bb5\u968e\u30671350\u5104\u3068\u3044\u3046\u6841\u9055\u3044\u306b\u591a\u3044\u30d1\u30e9\u30e1\u30fc\u30bf\u6570\u3067\u3057\u305f\u306e\u3067\u300170\u5104\u3067\u3082\u76f8\u5f53\u591a\u3044\u3088\u3046\u306b\u611f\u3058\u307e\u3059\u304c\u3001\u5927\u898f\u6a21\u8a00\u8a9e\u30e2\u30c7\u30eb\u306e\u4e2d\u3067\u306f\u5c0f\u3055\u3044\u30e2\u30c7\u30eb\u3001\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><h2 class=\"pageBlogLTitle\">\u73fe\u5728\u306e\u5927\u898f\u6a21\u8a00\u8a9e\u30e2\u30c7\u30eb<\/h2>\n<p>\u73fe\u5728\u306e\u5927\u898f\u6a21\u8a00\u8a9e\u30e2\u30c7\u30eb\u306b\u304a\u3044\u3066\u306f\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u6570\u304c\u591a\u3044\u307b\u3069\u7cbe\u5ea6\u304c\u9ad8\u3044\u3068\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u3088\u308a\u591a\u304f\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5165\u308c\u8fbc\u3080\u3053\u3068\u3067\u7cbe\u5ea6\u3092\u4e0a\u3052\u3066\u3044\u304f\u30a2\u30d7\u30ed\u30fc\u30c1\u306e\u4e00\u65b9\u3067\u3001\u5c11\u306a\u3044\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u3042\u308a\u306a\u304c\u3089\u3001\u9ad8\u7cbe\u5ea6\u3092\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306e\u6280\u8853\u3082\u3055\u307e\u3056\u307e\u306a\u7814\u7a76\u6210\u679c\u304b\u3089\u5b9f\u73fe\u3057\u59cb\u3081\u3066\u3044\u307e\u3059\u3002<br>\u30d1\u30e9\u30e1\u30fc\u30bf\u6570\u304c\u591a\u3044\u3068\u3044\u3046\u3053\u3068\u306f\u30e2\u30c7\u30eb\u306e\u30b5\u30a4\u30ba\u81ea\u4f53\u304c\u5927\u304d\u304f\u306a\u308a\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u305d\u308c\u3092\u7528\u3044\u3066\u8a08\u7b97\u3092\u3059\u308b\u5834\u5408\u306b\u3082\u81a8\u5927\u306a\u30d1\u30ef\u30fc\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u304c\u3001\u30e2\u30c7\u30eb\u30b5\u30a4\u30ba\u304c\u5c0f\u3055\u304f\u306a\u308c\u3070\u3001\u30d1\u30ef\u30fc\u306f\u5c11\u3057\u3067\u3082\u6e08\u3080\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<br>\u3064\u307e\u308a\u3001\u7406\u60f3\u7684\u306b\u306f\u30e2\u30c7\u30eb\u30b5\u30a4\u30ba\u3092\u53ef\u80fd\u306a\u9650\u308a\u5c0f\u3055\u304f\u3057\u3064\u3064\u3001\u7cbe\u5ea6\u3092\u9ad8\u3081\u308b\u3068\u3044\u3046\u76f8\u53cd\u3059\u308b\u30e2\u30c7\u30eb\u304c\u5b9f\u73fe\u3067\u304d\u308c\u3070\u826f\u3044\u306e\u3067\u3059\u304c\u3001\u73fe\u72b6\u3067\u306f\u307e\u3060\u306a\u304b\u306a\u304b\u96e3\u3057\u3044\u3068\u3053\u308d\u3067\u3059\u3002\u7814\u7a76\u306f\u9032\u3093\u3067\u3044\u3066\u3001\u5b9f\u969b\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u6570\u306fChatGPT\u3088\u308a\u3082\u5927\u5e45\u306b\u5c11\u306a\u3044\u306b\u3082\u95a2\u308f\u3089\u305a\u3001\u7cbe\u5ea6\u306f\u540c\u7b49\u3068\u3044\u3046\u30e2\u30c7\u30eb\u3082\u767b\u5834\u3057\u3066\u304d\u3066\u3044\u307e\u3059\u3002<\/p><\/p>\n\n\n\n<p>\u30e2\u30c7\u30eb\u30b5\u30a4\u30ba\u304c\u5c0f\u3055\u304f\u306a\u308c\u3070\u3001\u81ea\u5206\u306ePC\u4e0a\u3084\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3067ChatGPT\u3068\u540c\u3058\u3088\u3046\u306a\u3053\u3068\u304c\u3067\u304d\u308b\u53ef\u80fd\u6027\u3082\u3042\u308a\u3001\u305d\u3046\u306a\u308b\u3068\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3084\u60c5\u5831\u6f0f\u6d29\u306a\u3069\u306e\u5371\u967a\u3092\u8003\u3048\u305a\u306b\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u307b\u304b\u3001\u4ed6\u306e\u30b7\u30b9\u30c6\u30e0\u306b\u7d44\u307f\u8fbc\u3093\u3067\u3088\u308a\u5229\u4fbf\u6027\u306e\u9ad8\u3044\u4ed5\u7d44\u307f\u3092\u4f5c\u3063\u3066\u3044\u304f\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p><h2 class=\"pageBlogLTitle\">AIChatBot\u306e\u4f5c\u6210<\/h2>\n<p>\u65e2\u306b\u3042\u308b\u7a0b\u5ea6\u306e\u30b9\u30da\u30c3\u30af\u306ePC\u304c\u3042\u308c\u3070\u3001\u81ea\u5206\u3067\u5927\u898f\u6a21\u8a00\u8a9e\u30e2\u30c7\u30eb\u3092\u53d6\u5f97\u3057\u3066AIChatBot\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<br>\u81ea\u5206\u3067\u5927\u898f\u6a21\u8a00\u8a9e\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3059\u308b\u306e\u306f\u3001\u6b63\u76f4\u7121\u7406\u306a\u306e\u3067\u3001\u6761\u4ef6\u4ed8\u304d\u306a\u304c\u3089\u3082\u914d\u5e03\u3055\u308c\u3066\u3044\u308b\u5927\u898f\u6a21\u8a00\u8a9e\u30e2\u30c7\u30eb\u3092\u5229\u7528\u3059\u308b\u306e\u304c\u30d9\u30b9\u30c8\u3067\u3057\u3087\u3046\u3002<\/p><\/p>\n\n\n\n<p>\u4eca\u56de\u306f\u3001Meta\u793e\u304c\u63d0\u4f9b\u3057\u3066\u3044\u308bLlama2\u3092\u30d9\u30fc\u30b9\u306b\u682a\u5f0f\u4f1a\u793eELYZA\u304c\u516c\u958b\u3057\u305f\u300cELYZA-japananese-Llama-2-7b\u300d\u3092\u5229\u7528\u3057\u307e\u3059\u3002\u5143\u3005\u306eLlama2\u306f\u82f1\u8a9e\u304c\u4e3b\u3067\u3001\u57fa\u672c\u7684\u306b\u82f1\u8a9e\u3092\u8fd4\u7b54\u3068\u3057\u3066\u306f\u8fd4\u3057\u3066\u304d\u307e\u3059\uff08\u65e5\u672c\u8a9e\u306e\u7406\u89e3\u306f\u3055\u308c\u307e\u3059\uff09\u3002ELYZA-japananese-Llama-2-7b\u306f\u65e5\u672c\u8a9e\u306e\u8ffd\u52a0\u4e8b\u524d\u5b66\u7fd2\u30e2\u30c7\u30eb\u306b\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u65e5\u672c\u8a9e\u306e\u5229\u7528\u306b\u7279\u5316\u3057\u3066\u3044\u307e\u3059\u3002<br>PC\u306b\u7269\u7406\u30e1\u30e2\u30ea\u304c16GB\u4ee5\u4e0a\uff08\u3067\u304d\u308c\u307032GB\u4ee5\u4e0a\uff09\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002GPU\u3092\u4f7f\u308f\u305a\u306bCPU\u3060\u3051\u3067\u6f14\u7b97\u3092\u3059\u308b\u306e\u3067\u3001\u304b\u306a\u308a\u9045\u3044\u3067\u3059\u3002\uff08GPU\u3092\u4f7f\u3046\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002\u8a2d\u5b9a\u3059\u308b\u3068\u3001\u305d\u308c\u306a\u308a\u306b\u9ad8\u901f\u306b\u306a\u308a\u307e\u3059\uff09<\/p>\n\n\n\n<p>\u672b\u5c3e\u306e7b\u3068\u3044\u3046\u306e\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u6570\u3092\u793a\u3057\u3001Llama2\u3067\u306f7B,13B,70B\u306e3\u7a2e\u985e\u3042\u308a\u307e\u3059\u3002\u3082\u3063\u3068\u3082\u300113B\u8fba\u308a\u304b\u3089\u666e\u901a\u306ePC\u3067\u306f\u52d5\u4f5c\u3067\u304d\u306a\u304f\u306a\u308a\u300170B\u3067\u306f\u76f8\u5f53\u306a\u69cb\u6210\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u3001\u4e00\u822c\u7684\u306aPC\u3067\u52d5\u304b\u3059\u306e\u306f\u73fe\u5b9f\u7684\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u7cbe\u5ea6\u306f\u843d\u3061\u307e\u3059\u304c\u3001\u73fe\u72b6\u3067\u306f7B\u3092\u4f7f\u3063\u3066\u304a\u304f\u306e\u304c\u7121\u96e3\u3067\u3059\u3002\u66f4\u306b\u91cf\u5b50\u5316\u3068\u3044\u3046\u51e6\u7406\u3092\u3059\u308b\u3053\u3068\u3067\u3001\u7cbe\u5ea6\u306f\u82e5\u5e72\u843d\u3061\u307e\u3059\u304c\u3001\u3088\u308a\u9ad8\u6027\u80fd\u306a\u30b9\u30da\u30c3\u30af\u304c\u7121\u3044PC\u3067\u3082\u52d5\u4f5c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4f5c\u6210\u306b\u306f\u3001Python\u3092\u5229\u7528\u3059\u308b\u306e\u304c\u697d\u3067\u3059\u3002\u3082\u3061\u308d\u3093\u4ed6\u306e\u8a00\u8a9e\u304b\u3089\u3082\u5229\u7528\u304c\u53ef\u80fd\u3067\u3059\u304c\u3001\u4e00\u756a\u624b\u9593\u304c\u639b\u304b\u3089\u306a\u3044\u306e\u306fPython\u306a\u306e\u3067\u3001\u4eca\u56de\u306fPython\u304b\u3089\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><h2 class=\"pageBlogLTitle\">\u8a00\u8a9e\u3068\u4e0b\u6e96\u5099<\/h2>\n<p>Python\u3092\u8a00\u8a9e\u3068\u3057\u3066\u306f\u5229\u7528\u3057\u307e\u3059\u304c\u3001\u4eca\u56de\u306fC\u8a00\u8a9e\u7528\u306e\u30b3\u30f3\u30d1\u30a4\u30e9\u304c\u5fc5\u8981\u3067\u3059\u3002\u4e00\u756a\u7c21\u5358\u306a\u306e\u306f\u3001Windows\u74b0\u5883\u306e\u5834\u5408\u3001VisualStudio\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3001C\u8a00\u8a9e\u306e\u30b3\u30f3\u30d1\u30a4\u30e9\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304f\u306e\u304c\u7c21\u5358\u3067\u3059\uff08\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6642\u306e\u8a2d\u5b9a\u3067\u3001\u300c\u30aa\u30d7\u30b7\u30e7\u30f3\u300d\u9805\u76ee\u3092\u958b\u304d\u3001\u300c\u6700\u65b0\u306e v143 \u30d3\u30eb\u30c9\u30c4\u30fc\u30eb\u7528 C++ATL\uff08x86 \u304a\u3088\u3073 x64\uff09\u300d\u3068\u300c\u6700\u65b0\u306e v143 \u30d3\u30eb\u30c9\u30c4\u30fc\u30eb\u7528 C++MFC\uff08x86 \u304a\u3088\u3073 x64\uff09\u306b\u3082\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3059\uff09\u3002\u30e9\u30a4\u30bb\u30f3\u30b9\u898f\u7d04\u306b\u62b5\u89e6\u3057\u306a\u3044\u306e\u3067\u3042\u308c\u3070\u3001Community\u7248\u3067\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002mac\u74b0\u5883\u3067\u306f\u3001Xcode\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3059\u3002<br>Python3\u7cfb\u5217\u306e\u6700\u65b0\u7248\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3059\u3002pip\u3082\u5fd8\u308c\u305a\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p><\/p>\n\n\n\n<p>\u30e2\u30c7\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u304a\u304d\u307e\u3059\u3002<br><a href=\"https:\/\/huggingface.co\/mmnga\/ELYZA-japanese-Llama-2-7b-fast-instruct-gguf\/tree\/main\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/huggingface.co\/mmnga\/ELYZA-japanese-Llama-2-7b-fast-instruct-gguf\/tree\/main<\/a><br>\u3078\u30a2\u30af\u30bb\u30b9\u3057\u3001ELYZA-japanese-Llama-2-7b-fast-instruct-q8_0.gguf\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u304a\u304d\u307e\u3059\u3002\u3053\u308c\u306f7B\uff0870\u5104\uff09\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u30018Bit\u91cf\u5b50\u5316\u3092\u884c\u306a\u3063\u3066\u3044\u308b\u30e2\u30c7\u30eb\u3067\u3059\u3002<\/p>\n\n\n\n<p>pip\u3067\u5fc5\u8981\u306a\u30c4\u30fc\u30eb\u3092\u5165\u308c\u3066\u3044\u304d\u307e\u3059\u3002\u30bf\u30fc\u30df\u30ca\u30eb\u306a\u3069\u3092\u8d77\u52d5\u3057\u3066\u3001<br><div class=\"pageCodeArea\"><pre><code>$pip install llama-cpp-python<\/code><\/div>\u3067llama.cpp\u3068\u3044\u3046\u30e2\u30c7\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u304f\u308c\u308bC++\u8a00\u8a9e\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u3092\u5c0e\u5165\u3057\u307e\u3059\u3002\u540c\u6642\u306bllama.cpp\u3092\u4f7f\u3046\u305f\u3081\u306ePython\u7528\u30e9\u30a4\u30d6\u30e9\u30ea\u3082\u5c0e\u5165\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5c0e\u5165\u304c\u7d42\u308f\u3063\u305f\u3089Python\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002\u65e7\u6765\u306ellama-cpp-python\u306fGGML\u5f62\u5f0f\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u73fe\u5728\u306ellama-cpp-python\u306fGGUF\u5f62\u5f0f\u306e\u307f\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002\u3082\u3057\u3001GGML\u5f62\u5f0f\u306e\u30e2\u30c7\u30eb\u3092\u4f7f\u3044\u305f\u3044\u5834\u5408\u306f\u3001\u5909\u63db\u304c\u53ef\u80fd\u306a\u306e\u3067GGUF\u5f62\u5f0f\u306b\u5909\u63db\u3059\u308c\u3070\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"pageCodeArea\"><pre><code>!\/usr\/bin\/env python3\nimport sys\nimport os\nfrom llama_cpp import Llama\nsys.stdout.reconfigure(encoding='utf-8')\n\n#\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u8a18\u5165\nprompt = \"\"\"You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe.\nYour answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content.\nPlease ensure that your responses are socially unbiased and positive in nature.\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct.\nIf you don't know the answer to a question, please don't share false information.\n\"\"\"+\u3053\u3053\u306b\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u8a18\u5165+\"\"\"\nAssistant:\"\"\"\n# \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u53d6\u5f97\nscript_dir = os.path.dirname(os.path.realpath(__file__))\nmodel_path = os.path.join(script_dir, \"models\", \"ELYZA-japanese-Llama-2-7b-fast-instruct-q8_0.gguf\")\n\nllm = Llama(model_path=model_path)\n\n# \u751f\u6210\u5b9f\u884c\noutput = llm(prompt,max_tokens=500)\noutput_res = output['choices'][0]['text']\nprint(output_res)\n<\/code><\/pre><\/div>\n\n\n\n<p>\u300c\u3053\u3053\u306b\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u8a18\u5165\u300d\u306e\u3068\u3053\u308d\u3067\u3001\u805e\u304d\u305f\u3044\u3053\u3068\u3092\u5165\u529b\u3057\u3066\u5b9f\u884c\u3059\u308c\u3070\u7d50\u679c\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br>\u305f\u3060\u3001\u3053\u308c\u3060\u3068\u3001\u5358\u767a\u306e\u4f1a\u8a71\u3067\u7d42\u308f\u3063\u3066\u3057\u307e\u3044\u3001ChatGPT\u7684\u306a\u8a00\u8449\u306e\u6d41\u308c\u3092\u8003\u616e\u3057\u305f\u7d50\u679c\u306f\u5f97\u3089\u308c\u307e\u305b\u3093\u3002\u6d41\u308c\u3092\u8003\u616e\u3057\u305f\u7d50\u679c\u3092\u5f97\u308b\u305f\u3081\u306b\u306f\u3001\u4f1a\u8a71\u306e\u5185\u5bb9\u3092\u4fdd\u5b58\u3057\u3066\u304a\u3044\u3066\u3001\u6bce\u56de\u8cea\u554f\u3092\u6295\u3052\u308b\u3068\u304d\u306b\u5408\u308f\u305b\u3066\u4fdd\u5b58\u3057\u3066\u3044\u308b\u4f1a\u8a71\u306e\u5185\u5bb9\u3092\u4e0e\u3048\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"pageBlogLTitle\">\u6587\u8108\u3092\u8003\u616e\u3057\u305f\u30d1\u30bf\u30fc\u30f3<\/h3>\n\n\n\n<div class=\"pageCodeArea\"><pre><code>!\/usr\/bin\/env python3\nimport sys\nimport os\nfrom llama_cpp import Llama\nsys.stdout.reconfigure(encoding='utf-8')\n\nmessages = list()#\u4f1a\u8a71\u5c65\u6b74\u3092\u4fdd\u5b58\u3059\u308b\u914d\u5217\n\n#\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u8a18\u5165\n\nprompt = \"\"\"You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe.\nYour answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content.\nPlease ensure that your responses are socially unbiased and positive in nature.\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct.\nIf you don't know the answer to a question, please don't share false information.\n\"\"\"+\u3053\u3053\u306b\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u8a18\u5165+\"\"\"\nAssistant:\"\"\"\n\n#\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u53d6\u5f97\nscript_dir = os.path.dirname(os.path.realpath(file))\nmodel_path = os.path.join(script_dir, \"models\", \"ELYZA-japanese-Llama-2-7b-fast-instruct-q8_0.gguf\")\n\nllm = Llama(model_path=model_path)\n\nchat_completion_message: ChatCompletionMessage = dict(role=\"user\", content=prompt)\nmessages.append(chat_completion_message)\noutput = llm.create_chat_completion(messages=messages)\noutput_res = output['choices'][0]['message']\nprint(output_res[\"content\"])\n\nif output_res[\"role\"] == \"assistant\":\n    chat_completion_message = dict(role=\"assistant\", content=output_res[\"content\"])\n    messages.append(chat_completion_message)\n<\/code><\/pre><\/div>\n\n\n\n<p>\u306e\u3088\u3046\u306b\u3057\u3066\u3001\u914d\u5217\u306b\u53cc\u65b9\u306e\u5165\u529b\u5185\u5bb9\u3092\u683c\u7d0d\u3057\u3001\u90fd\u5ea6\u30e2\u30c7\u30eb\u306b\u4e0e\u3048\u308b\u3053\u3068\u3067\u6587\u8108\u3092\u8003\u616e\u3057\u305f\u7d50\u679c\u3092\u53d7\u3051\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u306f\u3001CPU\u3060\u3051\u306e\u51e6\u7406\u306b\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u7d50\u679c\u304c\u5f97\u3089\u308c\u308b\u307e\u3067\u305d\u308c\u306a\u308a\u306b\u6642\u9593\u304c\u639b\u304b\u308a\u307e\u3059\u3002\u3082\u3057\u3001\u9ad8\u901f\u5316\u3057\u305f\u3044\u5834\u5408\u306f\u3001GPU\u3092\u4f7f\u3046\u3088\u3046\u306b\u3059\u308b\u306a\u3069\u8a2d\u5b9a\u3092\u5909\u3048\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<br>7B\u30e2\u30c7\u30eb\u3092\u4f7f\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u7cbe\u5ea6\u306f\u30a4\u30de\u30a4\u30c1\u3067\u3059\u304c\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u8ffd\u52a0\u5b66\u7fd2\u3092\u884c\u306a\u3046\u3053\u3068\u3067\u3001\u3042\u308b\u7a0b\u5ea6\u7279\u5316\u3057\u305f\u6c4e\u7528\u7684\u306a\u30e2\u30c7\u30eb\u306b\u3057\u3066\u3044\u304f\u3053\u3068\u3082\u53ef\u80fd\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"pageBlogLTitle\">\u307e\u3068\u3081<\/h3>\n\n\n\n<p>\u306a\u304b\u306a\u304b\u500b\u4eba\u30ec\u30d9\u30eb\u3067\u3059\u3068\u3001\u5b9f\u7528\u7684\u306a\u901f\u5ea6\u3067\u52d5\u304b\u3059\u306e\u306f\u96e3\u3057\u3044\u3068\u3053\u308d\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u30e2\u30c7\u30eb\u3055\u3048\u624b\u306b\u5165\u308c\u3070\u6bd4\u8f03\u7684\u7c21\u5358\u306b\u4f5c\u6210\u3067\u304d\u308b\u3053\u3068\u304c\u308f\u304b\u308b\u306e\u3067\u306f\u7121\u3044\u3067\u3057\u3087\u3046\u304b\uff1f<br>\u4ed6\u306b\u3082\u30e2\u30c7\u30eb\u306f\u3044\u308d\u3044\u308d\u3068\u767b\u5834\u3057\u3066\u3044\u307e\u3059\u3002\u81ea\u5206\u306b\u3068\u3063\u3066\u9069\u5207\u3068\u601d\u3048\u308b\u3088\u3046\u306a\u30e2\u30c7\u30eb\u3092\u9078\u629e\u3057\u3066\u3001\u4f7f\u3063\u3066\u307f\u308b\u306e\u3082\u624b\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-comcent-blog-headline01 modHeadline\"><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>\u8a00\u8a9e\u30e2\u30c7\u30eb\u3068\u306f \u305d\u3082\u305d\u3082\u8a00\u8a9e\u30e2\u30c7\u30eb\u3068\u306f\u3001ChatGPT\u306b\u4ee3\u8868\u3055\u308c\u308b\u3001\u30c6\u30ad\u30b9\u30c8\u3092\u5165\u529b\u3059\u308b\u3068\u3001\u305d\u308c\u306b\u5bfe\u3059\u308b\u59a5\u5f53\u306a\u8fd4\u7b54\u3092\u8fd4\u3059AI\u6280\u8853\u306e\u4e2d\u6838\u3068\u306a\u308b\u3082\u306e\u3067\u3001\u5404\u5358\u8a9e\u306a\u3069\u306e\u7e4b\u304c\u308a\u3084\u610f\u5473\u7684\u306b\u8fd1\u3044\u304b\u3069\u3046\u304b\u306a\u3069\u3092\u6570\u5b66\u7684\u306b\u8868\u3057\u305f\u3082\u306e\u3092\u96c6\u5408\u3055\u305b [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":3476,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,13],"tags":[155,205,206,204,203],"coauthors":[52],"class_list":["post-3448","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-backend","category-frontend","tag-ai","tag-chatbot","tag-chatgpt","tag-llm","tag-python"],"author_meta":{"nickname":"sekiguchi","position":"CTO","icon_url":"https:\/\/comcent.co.jp\/blog\/images\/authorSk-150x150.png","author_url":"https:\/\/comcent.co.jp\/blog\/archives\/author\/sekiguchi\/"},"tag_names":["AI","ChatBot","ChatGPT","LLM","Python"],"thumbnail_url":"https:\/\/comcent.co.jp\/blog\/wp-content\/uploads\/2023\/12\/blog-300x200.jpg","_links":{"self":[{"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/posts\/3448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=3448"}],"version-history":[{"count":6,"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/posts\/3448\/revisions"}],"predecessor-version":[{"id":3539,"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/posts\/3448\/revisions\/3539"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/media\/3476"}],"wp:attachment":[{"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=3448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=3448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=3448"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/comcent.co.jp\/blog\/wp-json\/wp\/v2\/coauthors?post=3448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}