{"id":2762,"date":"2022-09-27T19:00:00","date_gmt":"2022-09-27T10:00:00","guid":{"rendered":"https:\/\/zeoninc.com\/blog\/?p=2762"},"modified":"2022-12-20T15:00:47","modified_gmt":"2022-12-20T06:00:47","slug":"september4","status":"publish","type":"post","link":"https:\/\/zeoninc.com\/blog\/2022\/09\/27\/september4\/","title":{"rendered":"\u52c9\u5f37\u4e2d\uff01"},"content":{"rendered":"\n<p>\u3053\u3093\u306b\u3061\u306f\uff01\u958b\u767a\u90e8\u306eAH\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4eca\u56de\u306f\u3001\u6587\u7ae0\u306e\u81ea\u52d5\u751f\u6210\u306b\u3064\u3044\u3066\u52c9\u5f37\u4e2d\u306e\u305f\u3081GPT\u306e\u4f7f\u3044\u65b9\u3092\u5fd8\u5099\u9332\u3092\u517c\u306d\u3066\u66f8\u3044\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>GPT\u3068\u306f\uff1f<br>OpenAI GPT\u3068\u306f2018\u5e74\u306b\u4e0b\u8a18\u8ad6\u6587\u3067\u63d0\u6848\u3055\u308c\u305f\u81ea\u7136\u8a00\u8a9e\u51e6\u7406\u30e2\u30c7\u30eb\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u539f\u8ad6\u6587\uff1aImproving Language Understanding by Generative Pre-Training<br><a href=\"https:\/\/s3-us-west-2.amazonaws.com\/openai-assets\/research-covers\/language-unsupervised\/language_understanding_paper.pdf\">https:\/\/s3-us-west-2.amazonaws.com\/openai-assets\/research-covers\/language-unsupervised\/language_understanding_paper.pdf<\/a><\/p>\n\n\n\n<p>AI\u306b\u4e8b\u524d\u5b66\u7fd2\u3055\u305b\u308b\u306b\u306f\u81a8\u5927\u306a\u6642\u9593\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u304c\u3001\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u306e\u308a\u3093\u306a\u3067\u6709\u540d\u306arinna\u793e\u304b\u3089\u4e8b\u524d\u5b66\u7fd2\u3092\u884c\u3063\u305f\u65e5\u672c\u8a9e\u30e2\u30c7\u30eb\u300crinna\/japanese-gpt-1b\u300d\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u305d\u308c\u3092\u4f7f\u3063\u3066\u6587\u7ae0\u306e\u81ea\u52d5\u751f\u6210\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u74b0\u5883\u69cb\u7bc9<br>\u307e\u305a\u306fpython\u304c\u4f7f\u3048\u306a\u3044\u3068\u4f55\u3082\u3067\u304d\u306a\u3044\u306e\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br>transformers\u3001SentencePiece\u3001pytorch\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br>GPU\u304c\u4f7f\u3048\u308bPC\u3060\u3068\u751f\u6210\u51e6\u7406\u304c\u901f\u304f\u306a\u308b\u3088\u3046\u306a\u306e\u3067\u3001\u3067\u304d\u308b\u3060\u3051GPU\u304c\u4e57\u3063\u3066\u3044\u308bPC\u304c\u3044\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3067\u74b0\u5883\u69cb\u7bc9\u3067\u304d\u305f\u306e\u3067\u65e9\u901f\u751f\u6210\u3092\u884c\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p>rinna\u793e\u304b\u3089\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3082\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3053\u3061\u3089\u3092\u4f7f\u3044\u307e\u3059\u3002<br><a href=\"https:\/\/huggingface.co\/rinna\/japanese-gpt-1b\">https:\/\/huggingface.co\/rinna\/japanese-gpt-1b<\/a><\/p>\n\n\n\n<div class=\"wp-block-group is-layout-flow wp-block-group-is-layout-flow\"><div class=\"wp-block-group__inner-container\"><\/div><\/div>\n\n\n\n<div class=\"wp-block-group is-layout-flow wp-block-group-is-layout-flow\"><div class=\"wp-block-group__inner-container\">\n<pre class=\"wp-block-code\"><code>import torch\nfrom transformers import T5Tokenizer, AutoModelForCausalLM\n\ntokenizer = T5Tokenizer.from_pretrained(\"rinna\/japanese-gpt-1b\")\nmodel = AutoModelForCausalLM.from_pretrained(\"rinna\/japanese-gpt-1b\")\n\nif torch.cuda.is_available():\n    model = model.to(\"cuda\")\n\ntext = \"\u897f\u7530\u5e7e\u591a\u90ce\u306f\u3001\"\ntoken_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors=\"pt\")\n\nwith torch.no_grad():\n    output_ids = model.generate(\n        token_ids.to(model.device),\n        max_length=100,\n        min_length=100,\n        do_sample=True,\n        top_k=500,\n        top_p=0.95,\n        pad_token_id=tokenizer.pad_token_id,\n        bos_token_id=tokenizer.bos_token_id,\n        eos_token_id=tokenizer.eos_token_id,\n        bad_word_ids=&#91;&#91;tokenizer.unk_token_id]]\n    )\n\noutput = tokenizer.decode(output_ids.tolist()&#91;0])\nprint(output)  <\/code><\/pre>\n<\/div><\/div>\n\n\n\n<p>\u300ctext = \u300d\u306b\u5165\u529b\u3057\u305f\u6587\u7ae0\u306b\u7d9a\u304f\u6587\u7ae0\u3092\u81ea\u52d5\u751f\u6210\u3057\u3066\u304f\u308c\u307e\u3059\u3002<br>\u306a\u306e\u3067\u3053\u306e\u5165\u529b\u6587\u7ae0\u3092\u5de5\u592b\u3059\u308b\u3053\u3068\u3067\u69d8\u3005\u306a\u6587\u7ae0\u3092\u751f\u6210\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u306f\u30b5\u30f3\u30d7\u30eb\u306e<br>\u300ctext = &#8220;\u897f\u7530\u5e7e\u591a\u90ce\u306f\u3001&#8221;\u300d<br>\u3092\u305d\u306e\u307e\u307e\u4f7f\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<ul>\n<li>\u51fa\u529b\u7d50\u679c1\uff1a<br>\u897f\u7530\u5e7e\u591a\u90ce\u306f\u3001\u8a00\u8449\u306e\u529b\u306b\u3088\u308a\u4e3b\u89b3\u306e\u52d5\u63fa\u3092\u93ae\u3081\u3088\u3046\u3068\u3059\u308b\u4ee5\u4e0a\u3001\u4e3b\u89b3\u3068\u5ba2\u89b3\u3068\u306e\u9593\u306b\u53b3\u7136\u3068\u5b58\u5728\u3059\u308b\u4e00\u7dda\u3092\u8aac\u3044\u3066\u3044\u308b\u3002\u4e3b\u89b3\u3068\u5ba2\u89b3\u306f\u5fc5\u7136\u7684\u7d71\u4e00\u4f53\u3060\u3001\u3068\u3002\u3057\u304b\u3057\u4e3b\u89b3\u306e\u63fa\u308c\u52d5\u304f\u610f\u8b58\u3082\u3001\u5ba2\u89b3\u7684\u306b\u773a\u3081\u308b\u306a\u3089\u3070\u3001\u8af8\u8981\u7d20\u304c\u4e92\u3044\u306b\u53cd\u6620\u3057\u5408\u3046\u4e00\u3064\u306e\u5168\u4f53\u3068\u3057\u3066\u5b58\u5728\u3057\u3066\u3044\u308b\u3002\u3053\u306e\u3001\u4e0d\u53ef\u5206\u306e\u3082\u306e\u3068\u4e0d\u53ef\u5206\u3067\u306a\u3044\u3082\u306e\u306e\u95a2\u4fc2\u306e\u3042\u308a\u65b9\u306f\u3001\u6211\u3005\u4e00\u4eba\u4e00\u4eba\u306e\u4eba\u751f\u306b\u6975\u3081\u3066\u91cd\u8981\u306a\u30c6\u30fc\u30de\u3068\u3057\u3066\u5e38\u306b\u554f\u308f\u308c\u3066\u304d\u3066\u3044\u308b\u3001\u3068\u601d\u3046\u306e\u3067\u3042\u308b\u3002\u4f8b\u3048\u3070\u3001\u300c\u609f<\/li>\n\n\n\n<li>\u51fa\u529b\u7d50\u679c2\uff1a<br>\u897f\u7530\u5e7e\u591a\u90ce\u306f\u3001\u7d14\u7c8b\u7d4c\u9a13\u306e\u9818\u57df\u3092\u6570\u5b66\u7684\u771f\u7406\u3068\u8003\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u8af8\u539f\u7406\u306b\u3088\u3063\u3066\u6e80\u305f\u3055\u308c\u3066\u3044\u308b\u3068\u307f\u3066\u3044\u308b\u3002 \u3053\u306e\u5834\u5408\u306b\u6211\u3005\u304c\u95a2 \u4e0e\u3059\u308b\u306e\u306f\u300c\u4e3b\u5ba2\u672a\u5206\u300d\u3067\u3042\u308b\u304c\u3001\u897f\u7530\u306b\u3068\u3063\u3066\u300c\u81ea\u7136\u72b6\u614b\u300d\u306f\u3001\u5b9f\u4f53\u306e\u9818\u57df\u306b\u3042 \u3063\u3066\u3082\u540d\u8f9e\u306e\u9818\u57df\u306b\u3042\u3063\u3066\u3082\u300c\u4e0d\u5728\u300d\u3067\u3042\u308b\u3002\u5ba2 \u89b3\u7684\u8af8\u6982\u5ff5\u306f\u4e00\u65e6\u300c\u5b9f\u5728\u6027\u300d\u304b\u3089\u5206\u304b\u308c\u3001\u4e3b\u89b3\u306b\u3088\u3063\u3066 \u521d\u3081\u3066\u305d\u308c\u3092\u300c\u5bfe\u8c61\u300d\u3068\u3088\u3076\u304c\u3001\u305d\u306e\u5bfe\u8c61\u306b\u3064\u3044\u3066\u306e\u300c\u5b9f\u5728\u6027\u300d\u306f\u6211\u3005\u306e\u4e86 \u89e3\u3067\u306f\u306a\u3044<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u51fa\u529b\u6bce\u306b\u7d50\u679c\u306f\u30e9\u30f3\u30c0\u30e0\u3067\u751f\u6210\u3055\u308c\u307e\u3059\u3002<br>\u9014\u4e2d\u3067\u5207\u308c\u3066\u3044\u307e\u3059\u304c\u304b\u306a\u308a\u81ea\u7136\u306a\u6587\u7ae0\u304c\u751f\u6210\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u7d9a\u3044\u3066<br>\u300ctext = &#8220;\u3080\u304b\u3057\u3080\u304b\u3057\u3042\u308b\u3068\u3053\u308d\u306b\u3001&#8221;\u300d<br>\u3067\u51fa\u529b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<ul>\n<li>\u51fa\u529b\u7d50\u679c1\uff1a<br>\u3080\u304b\u3057\u3080\u304b\u3057\u3042\u308b\u3068\u3053\u308d\u306b\u3001\u5927\u30cd\u30ba\u30df\u306e\u8ecd\u968a\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u5f7c\u3089\u306b\u4ed5\u4e8b\u3092\u8ab2\u3057\u305f\u308a\u3001\u5b9d\u7269\u3092\u63a2\u3055\u305b\u305f\u308a\u3057\u307e\u3057\u305f\u304c\u3001 \u968a\u54e1\u306f\u8a00\u3046\u3053\u3068\u3092\u805e\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 \u5f7c\u3089\u304c\u6398\u3063\u3066\u904b\u3093\u3060\u7269\u306f\u5168\u3066\u8150\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002 \u305d\u308c\u306b\u30cd\u30ba\u30df\u306e\u8ecd\u52e2\u306f\u3001\u3042\u307e\u308a\u6570\u304c\u591a\u304f\u3042\u308a\u307e\u305b\u3093\u3002 \u5927 \u304d\u3044\u3082\u306e\u306f\u50c5\u304b\u3067\u3001\u3068\u3066\u3082\u5f31\u3044\u306e\u3067\u3059\u3002 \u305d\u308c\u3067\u3001\u5f7c\u3089\u306f\u6bce\u65e5\u5927\u5909\u5927\u304d\u306a\u82e6\u5f79\u3092\u8ca0\u3044\u3001 \u305d\u308c\u3067\u3082\u5f7c\u3089\u306f1\u65e5\u4e2d\u3001\u50cd\u304b\u306a\u3044\u308f\u3051\u306b\u306f\u3044\u304d \u307e\u305b\u3093\u3002 \u5915\u65b9\u306b\u306a\u308c\u3070\u75b2\u308c\u3066\u3068\u305f\u3093\u306b\u7720\u308a\u3001 \u305d\u308c\u304b\u3089\u5f7c\u3089\u306f\u307e\u305f\u671d\u65e9\u304f\u304b\u3089\u50cd\u304d<\/li>\n\n\n\n<li>\u51fa\u529b\u7d50\u679c2\uff1a<br>\u3080\u304b\u3057\u3080\u304b\u3057\u3042\u308b\u3068\u3053\u308d\u306b\u3001\u3042\u308b\u3068\u3053\u308d\u306b\u3001\u4e09\u4eba\u306e\u5929\u4f7f\u304c\u3044\u307e\u3057\u305f\u3002\u6700\u521d\u306f\u3001\u3072\u3068\u304d\u308f\u80cc\u304c\u9ad8\u304f\u3066\u3001\u5927\u304d\u306a\u58f0\u3092\u6301\u3064\u3001\u91d1\u8272\u306e\u9df9\u3002\u91d1\u8272\u306e\u9df9\u306f\u3001\u305d\u306e\u58f0\u3060\u3051\u3067\u3001\u8857\u4e2d\u306e\u7f8e\u5973\u9054\u3092\u60da\u308c\u3055\u305b\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002\u3068\u3053\u308d\u304c\u3001\u3042\u308b\u591c\u306b\u3001\u5f7c\u5973\u304c\u753a\u306f\u305a\u308c\u3067\u9df9\u306e\u5316\u3051\u305f\u4eba\u9593\u306b\u8972\u308f\u308c\u305f\u8a71\u3092\u805e\u304d\u3001\u81ea\u5206\u3082\u8857\u306b\u964d\u308a\u3066\u3001\u3053\u3063\u305d\u308a\u5f7c\u5973\u306e\u4ec7\u3092\u8a0e\u3068\u3046\u3068\u3057\u307e\u3059\u3002\u7d50\u5c40\u3001\u9df9\u306e\u59ff\u3092\u898b\u305f\u753a\u306e\u4eba\u3005\u306f\u3001\u9df9\u306e\u5371\u967a\u3092\u6016\u308c\u3001\u9df9\u3092\u6355\u307e\u3048<\/li>\n<\/ul>\n\n\n\n<p>\u540c\u3058\u5358\u8a9e\u304c\u51fa\u3066\u304d\u305f\u308a\u9014\u4e2d\u3067\u9014\u5207\u308c\u305f\u308a\u306f\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e2d\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5f04\u308b\u3068\u8abf\u6574\u304c\u53ef\u80fd\u306a\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3067\u3082\u304b\u306a\u308a\u81ea\u7136\u306a\u6587\u7ae0\u304c\u751f\u6210\u3067\u304d\u3066\u3044\u307e\u3059\u304c\u3001\u4f8b\u3048\u3070\u300c\u5bae\u6ca2\u8ce2\u6cbb\u3063\u307d\u3044\u6587\u7ae0\u306b\u3057\u305f\u3044\u300d\u3084\u300c\u30cb\u30e5\u30fc\u30b9\u8a18\u4e8b\u306e\u3088\u3046\u306a\u6587\u7ae0\u306b\u3057\u305f\u3044\u300d\u306a\u3069\u66f8\u304d\u305f\u3044\u3053\u3068\u306b\u5408\u308f\u305b\u305f\u6587\u7ae0\u3092\u751f\u6210\u3057\u305f\u3044\u5834\u5408\u306f<br>\u30d5\u30a1\u30a4\u30f3\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308b\u3068\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30d5\u30a1\u30a4\u30f3\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u3068\u306f\u5b66\u7fd2\u6e08\u307f\u306e\u30e2\u30c7\u30eb\u306b\u3001\u751f\u6210\u3057\u305f\u3044\u6587\u7ae0\u306b\u5408\u308f\u305b\u305f\u30c7\u30fc\u30bf\u3067\u306e\u518d\u5b66\u7fd2\u3092\u884c\u3046\u3053\u3068\u306e\u3088\u3046\u3067\u3059\u3002<br>\u300c\u5bae\u6ca2\u8ce2\u6cbb\u3063\u307d\u3044\u6587\u7ae0\u306b\u3057\u305f\u3044\u300d\u5834\u5408\u3001\u5bae\u6ca2\u8ce2\u6cbb\u306e\u5c0f\u8aac\u306e\u30c7\u30fc\u30bf\u3092\u518d\u5b66\u7fd2\u3055\u305b\u308b\u3053\u3068\u3067\u305d\u308c\u3063\u307d\u3044\u6587\u7ae0\u306e\u751f\u6210\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3057\u30d5\u30a1\u30a4\u30f3\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u306b\u306f\u30c7\u30fc\u30bf\u91cf\u306b\u6bd4\u4f8b\u3057\u305f\u6642\u9593\u304c\u5fc5\u8981\u3068\u306e\u3053\u3068\u3001\u884c\u3046\u306b\u306f\u304b\u306a\u308a\u306e\u6642\u9593\u304c\u5fc5\u8981\u306a\u3088\u3046\u3067\u4eca\u56de\u306f\u6642\u9593\u304c\u306a\u3044\u305f\u3081\u3053\u3053\u307e\u3067\u306b\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p><br>\u4eca\u5f8c\u6a5f\u4f1a\u304c\u3042\u308c\u3070\u30d5\u30a1\u30a4\u30f3\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u306b\u3064\u3044\u3066\u3082\u66f8\u3044\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6587:\u958b\u767a\u90e8AH<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff01\u958b\u767a\u90e8\u306eAH\u3067\u3059\u3002 \u4eca\u56de\u306f\u3001\u6587\u7ae0\u306e\u81ea\u52d5\u751f\u6210\u306b\u3064\u3044\u3066\u52c9\u5f37\u4e2d\u306e\u305f\u3081GPT\u306e\u4f7f\u3044\u65b9\u3092\u5fd8\u5099\u9332\u3092\u517c\u306d\u3066\u66f8\u3044\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 GPT\u3068\u306f\uff1fOpenAI GPT\u3068\u306f2018\u5e74\u306b\u4e0b\u8a18\u8ad6\u6587\u3067\u63d0\u6848\u3055\u308c\u305f\u81ea\u7136\u8a00\u8a9e\u51e6\u7406\u30e2\u30c7\u30eb\u3067 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":2773,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,8],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/posts\/2762"}],"collection":[{"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/comments?post=2762"}],"version-history":[{"count":10,"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/posts\/2762\/revisions"}],"predecessor-version":[{"id":2911,"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/posts\/2762\/revisions\/2911"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/media\/2773"}],"wp:attachment":[{"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/media?parent=2762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/categories?post=2762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zeoninc.com\/blog\/wp-json\/wp\/v2\/tags?post=2762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}