{"id":12190,"date":"2023-11-15T09:16:52","date_gmt":"2023-11-15T09:16:52","guid":{"rendered":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/?p=12190"},"modified":"2024-10-26T06:13:04","modified_gmt":"2024-10-26T06:13:04","slug":"%e3%80%8cpytorch%e3%81%a8fastai%e3%81%a7%e3%81%af%e3%81%98%e3%82%81%e3%82%8b%e3%83%87%e3%82%a3%e3%83%bc%e3%83%97%e3%83%a9%e3%83%bc%e3%83%8b%e3%83%b3%e3%82%b0%e3%80%8d%e3%82%92%e8%aa%ad%e3%82%80","status":"publish","type":"post","link":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/?p=12190","title":{"rendered":"\u300cpytorch\u3068fastai\u3067\u306f\u3058\u3081\u308b\u30c7\u30a3\u30fc\u30d7\u30e9\u30fc\u30cb\u30f3\u30b0\u300d\u3092\u8aad\u3080"},"content":{"rendered":"<p><a href=\"https:\/\/www.oreilly.co.jp\/books\/9784873119427\/\">\u300cpytorch\u3068fastai\u3067\u306f\u3058\u3081\u308b\u30c7\u30a3\u30fc\u30d7\u30e9\u30fc\u30cb\u30f3\u30b0\u300d<\/a>\u3092\u8aad\u3093\u3067\u3044\u304f\u4e0a\u3067\u306e\u6ce8\u610f\u70b9\u3092\u8a18\u9332\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f5c\u6210\u3057\u305f\u30bd\u30d5\u30c8\u3092\u6700\u7d42\u7684\u306b\u306f\u30ed\u30fc\u30ab\u30eb\u306e\u30d1\u30bd\u30b3\u30f3\u3067\u5b9f\u884c\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u306e\u3067\uff0cgoogle colab \u3067\u306f\u306a\u304f\u3066\uff0c\u30ed\u30fc\u30ab\u30eb\u306e\u30d1\u30bd\u30b3\u30f3\u3067\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u74b0\u5883\u3092\u4f5c\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/oreilly-japan.github.io\/fastai_book_jp\/start_colab\/\">\u30b3\u30fc\u30c9\u306a\u3069\u306e\u30b5\u30a4\u30c8<\/a><\/p>\n<p>\u6700\u521d\u306b\uff0cubuntu \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u3059\u3002\u6700\u5c0f\u9650\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u9078\u629e\u3057\u307e\u3059\u3002\u305d\u306e\u5834\u5408\u306b\u306f numpy \u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u30d3\u30c7\u30aa\u30ab\u30fc\u30c9\u306e\u30c9\u30e9\u30a4\u30d0\u30fc\u3092\u5165\u308c\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u6b21\u306b\uff0cCUDA \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u3059\u3002\u624b\u9806\u306f<a href=\"https:\/\/developer.nvidia.com\/cuda-downloads\">\u3053\u306e\u30b5\u30a4\u30c8<\/a>\u306b\u5f93\u3044\u307e\u3059\u3002CUDA \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\uff0c\u305d\u306e\u3042\u3068\u30b5\u30a4\u30c8\u306b\u5f93\u3063\u3066\u30d3\u30c7\u30aa\u30ab\u30fc\u30c9\u306e\u30c9\u30e9\u30a4\u30d0\u30fc\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>nvidia-smi \u306e\u51fa\u529b\u3067\u3059\u3002<\/p>\n<p><code ><font size = \"1\"><br \/>\n~$ nvidia-smi<br \/>\nThu Nov 16 15:11:52 2023<br \/>\n+---------------------------------------------------------------------------------------+<br \/>\n| NVIDIA-SMI 545.23.06              Driver Version: 545.23.06    CUDA Version: 12.3     |<br \/>\n|-----------------------------------------+----------------------+----------------------+<br \/>\n| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |<br \/>\n| Fan  Temp   Perf          Pwr:Usage\/Cap |         Memory-Usage | GPU-Util  Compute M. |<br \/>\n|                                         |                      |               MIG M. |<br \/>\n|=========================================+======================+======================|<br \/>\n|   0  NVIDIA RTX A4000               On  | 00000000:17:00.0 Off |                  Off |<br \/>\n| 41%   33C    P8              18W \/ 140W |   3569MiB \/ 16376MiB |      0%      Default |<br \/>\n|                                         |                      |                  N\/A |<br \/>\n+-----------------------------------------+----------------------+----------------------+<\/p>\n<p>+---------------------------------------------------------------------------------------+<br \/>\n| Processes:                                                                            |<br \/>\n|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |<br \/>\n|        ID   ID                                                             Usage      |<br \/>\n|=======================================================================================|<br \/>\n|    0   N\/A  N\/A     17151      G   \/usr\/lib\/xorg\/Xorg                           94MiB |<br \/>\n|    0   N\/A  N\/A     17274      G   \/usr\/bin\/gnome-shell                          7MiB |<br \/>\n|    0   N\/A  N\/A     24586      C   \/usr\/bin\/python3                           3454MiB |<br \/>\n+---------------------------------------------------------------------------------------+<br \/>\n<\/font><br \/>\n<\/code><\/p>\n<p>\u3053\u306e\u3042\u3068\u3001Python \u95a2\u9023\u306e\u3082\u306e\u3092\u5165\u308c\u307e\u3059\u3002synaptic \u3067jupyter-notebook\u3001python3-pip \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u305d\u306e\u3042\u3068\u3067\u3001\u4e0b\u8a18\u3067 cupy \u3092\u5165\u308c\u308b\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">$ sudo python3 -m pip install -U setuptools pip\r\n$ sudo pip3 install cupy-cuda12x<\/code><\/pre>\n<p>\uff11\u884c\u76ee\u306e\u30b3\u30de\u30f3\u30c9\u304c\u52b9\u3044\u3066\u3044\u308b\u306e\u304b\u3069\u3046\u304b\u5206\u304b\u3089\u306a\u3044\u3002sudo \u3067\u3084\u308b\u5fc5\u8981\u306f\u3042\u308b\u3068\u601d\u3046\u300212x \u306f\u672c\u5f53\u306b x \u3092\u66f8\u3044\u305f\u3002pandas\u3001matplotlib \u306f\u5f8c\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u4e88\u5b9a\u3067\u3059\u3002numpy \u306f\u95a2\u9023\u3059\u308b\u30bd\u30d5\u30c8\u3068\u3057\u3066\uff0c\u540c\u6642\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u305f\u6a21\u69d8\u3067\u3059\u3002\u4ee5\u4e0b\uff0c\u3044\u308d\u3044\u308d\u3068\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u898b\u3066\u307f\u307e\u3057\u305f\u3002scipy\uff0csympy \u3082\u77e5\u3089\u306c\u9593\u306b\u5165\u308a\u307e\u3057\u305f\u3002numpy \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u65b0\u3057\u3059\u304e\u308b\u3088\u3046\u306a\u6c17\u304c\uff1f\u6700\u521d\u3068\u7570\u306a\u308b\u3088\u3046\u306a\u304d\u304c\u3059\u308b\u304c\uff1f<\/p>\n<p><a href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231116a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231116a.png\" alt=\"\" width=\"648\" height=\"669\" class=\"aligncenter size-full wp-image-12205\" srcset=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231116a.png 648w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231116a-291x300.png 291w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231116a-600x619.png 600w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u8a66\u3057\u3066\u3044\u308b\u74b0\u5883\u3067\u3059\u304c\u3001\u4e0a\u8a18\u3067\u3042\u3052\u305f\u30ea\u30f3\u30af\u5148\u306e\u30da\u30fc\u30b8\u306b\u306f\uff08<a href=\"https:\/\/colab.research.google.com\/github\/fastai\/fastbook\/blob\/master\/01_intro.ipynb\">\u4f8b\u3048\u3070\u3053\u3053<\/a>\uff09\u306b\u300c\u30c9\u30e9\u30a4\u30d6\u3078\u306e\u30b3\u30d4\u30fc\u300d\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123a-1024x647.png\" alt=\"\" width=\"600\" height=\"379\" class=\"aligncenter size-large wp-image-12233\" srcset=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123a-1024x647.png 1024w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123a-300x190.png 300w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123a-768x485.png 768w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123a-1536x970.png 1536w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123a-600x379.png 600w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123a.png 1575w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>\u3053\u308c\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002Ubuntu22 \u306a\u306e\u3067\u3059\u304c\u3001\u30d5\u30a1\u30a4\u30eb\u306f\u81ea\u5206\u306e\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u30fc\u306e\u4e2d\u306b\u3042\u308a\u307e\u3059\u3002\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u7aef\u672b\u304b\u3089\u8d77\u52d5\u3057\u305f\u30ed\u30fc\u30ab\u30eb\u3067\u52d5\u3044\u3066\u3044\u308b jypyter-notebook \u304b\u3089\u5229\u7528\u3057\u307e\u3059\u3002\u9014\u4e2d\u9014\u4e2d\u3067\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u305f\u969b\u306b\u3001\u30c7\u30fc\u30bf\u306a\u3069\u304c\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3055\u308c\u308b\u306e\u3067\u3059\u304c\u3001\u305d\u308c\u306f\u30db\u30fc\u30e0\u306e\u96a0\u308c\u30d5\u30a9\u30eb\u30c0\u30fc\u3001\u300c.fastai\u300d\u306e\u4e2d\u306b\u53ce\u3081\u3089\u308c\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123b-300x185.png\" alt=\"\" width=\"300\" height=\"185\" class=\"aligncenter size-medium wp-image-12236\" srcset=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123b-300x185.png 300w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123b-768x472.png 768w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123b-600x369.png 600w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231123b.png 894w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u4ee5\u4e0b\uff0c\u672c\u3092\u8aad\u307f\u306a\u304c\u3089\u306e\u8272\u3005\u3092\u8a18\u9332\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><strong>p16\u3042\u305f\u308a<\/strong><\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">#hide\r\n! [ -e \/content ] && pip install -Uqq fastbook\r\nimport fastbook\r\nfastbook.setup_book()<\/code><\/pre>\n<p>\u672c\u306e\u65b9\u306b\u306f\u306a\u3044\u304c\uff0c\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306b\u4e0a\u8a18\u306e\u3088\u3046\u306a\u3082\u306e\u304c\u3042\u308b\u3002colab \u3067\u306f\u3053\u306e\u307e\u307e\u52d5\u304f\u3002\u30ed\u30fc\u30ab\u30eb\u3067\u5b9f\u884c\u3059\u308b\u306a\u3089\uff0cfastbook \u306f\u666e\u901a\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u65b9\u304c\u826f\u3044\u30022\u884c\u76ee\u306f\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3066\u304a\u3044\u3066\uff0c\u7aef\u672b\u3067\u4e0b\u8a18\u3092\u5b9f\u884c\u3057\u305f\u3002<\/p>\n<ul>sudo pip3 install -Uqq fastbook<\/ul>\n<p>\u3053\u308c\u3067\uff0cfastbook \u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u53ef\u80fd\u3068\u306a\u3063\u305f\u3002<\/p>\n<p><strong>p16<\/strong><\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">#id first_training\r\n#caption Results from the first training\r\n# CLICK ME\r\nfrom fastai.vision.all import *\r\npath = untar_data(URLs.PETS)\/'images'\r\n\r\ndef is_cat(x): return x[0].isupper()\r\ndls = ImageDataLoaders.from_name_func(\r\n    path, get_image_files(path), valid_pct=0.2, seed=42,\r\n    label_func=is_cat, item_tfms=Resize(224))\r\n\r\nlearn = vision_learner(dls, resnet34, metrics=error_rate)\r\nlearn.fine_tune(1)<\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306f\uff0c\u30d3\u30c7\u30aa\u30e1\u30e2\u30ea\u304c 2GB \u306e\u30ab\u30fc\u30c9\u3067\u306f\uff0c\u30e1\u30e2\u30ea\u4e0d\u8db3\u3067\u30a8\u30e9\u30fc\u3068\u306a\u3063\u305f\u30026GB \u306f\u5927\u4e08\u592b\u3060\u3063\u305f\u3002<\/p>\n<p><strong>p17<\/strong><\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">#hide_output\r\nuploader = widgets.FileUpload()\r\nuploader<\/code><\/pre>\n<p>module &#8216;ipywidgets.widgets&#8217; has no attribute &#8216;FileUpload&#8217; \u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u3067\u308b\u3002\u3053\u3053\u306e<a href=\"https:\/\/stackoverflow.com\/questions\/59435384\/the-ipywidgets-function-fileupload-is-not-found-when-run-on-jupyter-notebook\">\u30b5\u30a4\u30c8<\/a>\u306b\u3088\u308c\u3070\u3001ipywidgets \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30927.5\u4ee5\u4e0a\u306b\u3057\u308d\u3068\u3042\u308b\u3002<\/p>\n<ul>sudo pip3 install ipywidgets==7.5<\/ul>\n<p>sudo pip3 \u306e\u3068\u3053\u308d\u306f\u3001\u3059\u3079\u3066\u306e\u30e6\u30fc\u30b6\u30fc\u3067\u6709\u52b9\u306b\u3059\u308b\u304b\u3069\u3046\u304b\u306b\u3088\u3063\u3066\u7570\u306a\u308b\u3060\u308d\u3046\u3002\u3053\u308c\u306b\u3088\u3063\u3066\uff0c\u30dc\u30bf\u30f3\u306f\u8868\u793a\u3055\u308c\u305f\u304c\uff0c\u4e0a\u624b\u304f\u6a5f\u80fd\u3057\u306a\u304b\u3063\u305f\u3002\u305d\u308c\u3067\uff0c\u305d\u306e\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u305f\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">#hide\r\n# For the book, we can't actually click an upload button, so we fake it\r\nuploader = SimpleNamespace(data = ['images\/chapter1_cat_example.jpg'])<\/code><\/pre>\n<p>\u30d5\u30a1\u30a4\u30eb\u3078\u306e\u30d1\u30b9\u306f\u9069\u5f53\u306b\u7de8\u96c6\u3059\u308b\u3002\u3053\u308c\u306f\u6a5f\u80fd\u3057\u3066\uff0c\u4e0b\u8a18\u306e\u3088\u3046\u306b\u4e0a\u624b\u304f\u3044\u3063\u305f\u3002<\/p>\n<p><a href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231117a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231117a-1024x238.png\" alt=\"\" width=\"600\" height=\"139\" class=\"aligncenter size-large wp-image-12227\" srcset=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231117a-1024x238.png 1024w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231117a-300x70.png 300w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231117a-768x179.png 768w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231117a-600x140.png 600w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231117a.png 1061w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>1.000000 \u3068\u3044\u3046\u9a5a\u304d\u306e\u5224\u5b9a\u7d50\u679c\u3060\u3063\u305f\u3002\u72ac\u306e\u5199\u771f\u3067\u306f\uff0c\u3061\u3083\u3093\u3068 false \u306b\u306a\u3063\u305f\u306e\u3067\uff0c\u5927\u4e08\u592b\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3046\u3002<\/p>\n<p><strong>2\u7ae0<\/strong><\/p>\n<p>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306e\u6700\u521d\u306e\u6240\u3067\uff0cnumpy \u306b\u95a2\u3057\u3066\uff0c\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u8b66\u544a\u304c\u51fa\u305f\u3002\u524d\u3082\u51fa\u305f\u3088\u3046\u306b\u601d\u3046\u3002<\/p>\n<p><a href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231124a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231124a-1024x224.png\" alt=\"\" width=\"600\" height=\"131\" class=\"aligncenter size-large wp-image-12239\" srcset=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231124a-1024x224.png 1024w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231124a-300x66.png 300w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231124a-768x168.png 768w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231124a-600x131.png 600w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231124a.png 1322w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>numpy \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u4e0b\u3052\u3066\u307f\u3088\u3046\u3068\u601d\u3046\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">sudo pip3 uninstall numpy\r\nsudo pip3 install numpy==1.24.4<\/code><\/pre>\n<p>pip3 list \u3067\u78ba\u8a8d\u3059\u308b\u3068\u3001\u5909\u66f4\u3055\u308c\u3066\u3044\u305f\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">$ pip3 list\r\nPackage                  Version\r\n------------------------ ----------------\r\naiohttp                  3.8.6\r\naiosignal                1.3.1\r\nannotated-types          0.6.0\r\n\r\n\u9014\u4e2d\u7701\u7565\r\n\r\nnumpy                    1.24.4<\/code><\/pre>\n<p><strong>p61\u3042\u305f\u308a<\/strong><\/p>\n<p>azure \u3092\u4e0a\u624b\u304f\u5229\u7528\u3067\u304d\u306a\u3044\u3002ImageNet \u306e\u753b\u50cf\u3067\u540c\u3058\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u304b\u691c\u8a0e\u3057\u3066\u307f\u308b\u3002\u4ee5\u4e0b\u306f\u53c2\u7167\u30b5\u30a4\u30c8\u306a\u3069\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/zenn.dev\/hidetoshi\/articles\/20210703_how_to_download_imagenet\">ImageNet(ILSVRC2012)\u3092\u516c\u5f0f\u30b5\u30a4\u30c8\u304b\u3089\u76f4\u63a5\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u65b9\u6cd5<\/a><\/li>\n<li><a href=\"https:\/\/zenn.dev\/hidetoshi\/articles\/20210717_pytorch_dataset_for_imagenet\">PyTorch\u306eDataset\u3067ImageNet(ILSVRC2012)\u3092\u6271\u3046<\/a><\/li>\n<li><a href=\"https:\/\/gist.github.com\/fnielsen\/4a5c94eaa6dcdf29b7a62d886f540372\">ImageNet label to wordnet synset identifier<\/a><\/li>\n<\/ul>\n<p>ImageNet \u306e2012\u5e74\u306e\u30c7\u30fc\u30bf\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u3002\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u7528\u306e\u30d5\u30a1\u30a4\u30eb ILSVRC2012_img_train \u306e\u4e2d\u306b\u3042\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u5229\u7528\u3059\u308b\u3002\u5148\u306b\u4e0a\u3052\u305f<a href=\"https:\/\/gist.github.com\/fnielsen\/4a5c94eaa6dcdf29b7a62d886f540372\">\u30b5\u30a4\u30c8<\/a>\u306b\u3088\u308c\u3070\u300102132136-n \u304c\u30b0\u30ea\u30ba\u30ea\u30fc\uff08brown bear\uff09\u3067\u300102133161-n \u304c American black bear\u300104399382-n \u304c teddy \u3067\u3042\u308b\u3002\u305d\u308c\u305e\u308c\u753b\u50cf\u306f1500\u500b\u3042\u308b\u3002\u3053\u308c\u30922\u7ae0\u306e\u30b3\u30fc\u30c9\u3068\u540c\u3058\u4f4d\u7f6e\u306b\u914d\u7f6e\u3059\u308b\u3002\u30d5\u30a9\u30eb\u30c0\u30fc\u69cb\u6210\u306f\u30b3\u30fc\u30c9\u3068\u540c\u3058\u4f4d\u7f6e\u306b bears \u30d5\u30a9\u30eb\u30c0\u30fc\u3092\u4f5c\u308a\u305d\u306e\u4e2d\u306b grizzly, black, teddy \u30d5\u30a9\u30eb\u30c0\u30fc\u3092\u4f5c\u308b\u3002\u753b\u50cf\u306f\u3059\u3079\u3066\u3067\u306f\u306a\u304f\u3066\u3001\u305d\u308c\u305e\u308c150\u500b\u307b\u3069\u306e\u753b\u50cf\u3092\u7f6e\u3044\u305f\u3002\u753b\u50cf\u306e\u30e9\u30d9\u30eb\u306f\u30d5\u30a9\u30eb\u30c0\u30fc\u540d\u304b\u3089\u53d6\u5f97\u3059\u308b\u3088\u3046\u3067\u3001\u3053\u308c\u30672\u7ae0\u306e\u30b3\u30fc\u30c9\u3092\u52d5\u304b\u3059\u3053\u3068\u304c\u3067\u304d\u305f\u3002\u4e0b\u8a18\u306f\u3001p71 \u306e\u6df7\u540c\u884c\u5217\u306e\u7d50\u679c\u3067\u3042\u308b\u3002\u6559\u79d1\u66f8\u306e\u7d50\u679c\u3068\u6bd4\u3079\u3066\u3001\u591a\u5c11\u9593\u9055\u3044\u304c\u591a\u304f\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<p><a href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231230a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231230a.png\" alt=\"\" width=\"551\" height=\"406\" class=\"aligncenter size-full wp-image-12301\" srcset=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231230a.png 551w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231230a-300x221.png 300w\" sizes=\"auto, (max-width: 551px) 100vw, 551px\" \/><\/a><\/p>\n<p>p77 \u3042\u305f\u308a\u306e VBox \u3082\u4e0a\u624b\u304f\u884c\u304d\u307e\u3057\u305f\u3002\u3053\u3053\u306e Upload \u30dc\u30bf\u30f3\u306f\u6a5f\u80fd\u3059\u308b\u3002\u4f55\u304c\u9055\u3046\u306e\u3060\u308d\u3046\u304b\uff1f<\/p>\n<p><a href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231231a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231231a.png\" alt=\"\" width=\"499\" height=\"301\" class=\"aligncenter size-full wp-image-12303\" srcset=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231231a.png 499w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20231231a-300x181.png 300w\" sizes=\"auto, (max-width: 499px) 100vw, 499px\" \/><\/a><\/p>\n<p>voila \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u3053\u308c\u306f\u7aef\u672b\u3067\u3084\u308a\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u8272\u3005\u3068\u4e0a\u624b\u304f\u3044\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u3057\u306a\u3044\u307b\u3046\u304c\u3044\u3044\u304b\u3082\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">sudo pip3 install voila\r\nsudo jupyter serverextension enable --sys-prefix voila<\/code><\/pre>\n<p>voila \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u5f8c\u3001jupyter-notebook \u304c\u8d77\u52d5\u3057\u306a\u304f\u306a\u3063\u305f\u3002\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u3067\u308b\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">Traceback (most recent call last):\r\n  File \"\/usr\/lib\/python3\/dist-packages\/notebook\/traittypes.py\", line 232, in _resolve_classes\r\n    klass = self._resolve_string(klass)\r\n  File \"\/usr\/local\/lib\/python3.10\/dist-packages\/traitlets\/traitlets.py\", line 2018, in _resolve_string\r\n    return import_item(string)\r\n  File \"\/usr\/local\/lib\/python3.10\/dist-packages\/traitlets\/utils\/importstring.py\", line 31, in import_item\r\n    module = __import__(package, fromlist=[obj])\r\nModuleNotFoundError: No module named 'jupyter_server.contents'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"\/usr\/bin\/jupyter-notebook\", line 33, in <module>\r\n    sys.exit(load_entry_point('notebook==6.4.8', 'console_scripts', 'jupyter-notebook')())\r\n  File \"\/usr\/local\/lib\/python3.10\/dist-packages\/jupyter_core\/application.py\", line 281, in launch_instance\r\n    super().launch_instance(argv=argv, **kwargs)\r\n  File \"\/usr\/local\/lib\/python3.10\/dist-packages\/traitlets\/config\/application.py\", line 1075, in launch_instance\r\n    app = cls.instance(**kwargs)\r\n  File \"\/usr\/local\/lib\/python3.10\/dist-packages\/traitlets\/config\/configurable.py\", line 583, in instance\r\n    inst = cls(*args, **kwargs)\r\n  File \"\/usr\/local\/lib\/python3.10\/dist-packages\/traitlets\/traitlets.py\", line 1294, in __new__\r\n    inst.setup_instance(*args, **kwargs)\r\n  File \"\/usr\/local\/lib\/python3.10\/dist-packages\/traitlets\/traitlets.py\", line 1337, in setup_instance\r\n    super(HasTraits, self).setup_instance(*args, **kwargs)\r\n  File \"\/usr\/local\/lib\/python3.10\/dist-packages\/traitlets\/traitlets.py\", line 1313, in setup_instance\r\n    init(self)\r\n  File \"\/usr\/lib\/python3\/dist-packages\/notebook\/traittypes.py\", line 223, in instance_init\r\n    self._resolve_classes()\r\n  File \"\/usr\/lib\/python3\/dist-packages\/notebook\/traittypes.py\", line 235, in _resolve_classes\r\n    warn(f\"{klass} is not importable. Is it installed?\", ImportWarning)\r\nTypeError: warn() missing 1 required keyword-only argument: 'stacklevel'\r\n<\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/jupyterhub\/jupyterhub\/issues\/4418\">\u3053\u306e\u30b5\u30a4\u30c8<\/a>\u306a\u3069\u3092\u898b\u3066\u3001traitlets \u3092\u524a\u9664\u3057\u3066\u307f\u305f\u3002pip3 list \u306a\u3069\u3067\u898b\u308b\u3068\u3001traitlets \u306f 5.14.0 \u304c\u5165\u3063\u3066\u3044\u305f\u3088\u3046\u3060\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">sudo pip3 uninstall traitlets<\/code><\/pre>\n<p>\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u306f\u306a\u3063\u305f\u3002voila \u306f\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3002\u3053\u308c\u4ee5\u964d\u306e2\u7ae0\u306e\u30b3\u30fc\u30c9\u306f\u5b9f\u884c\u3092\u8ae6\u3081\u308b\u3002<\/p>\n<p><strong>p73<\/strong><\/p>\n<p>\u30e2\u30c7\u30eb\u3092\u4e0b\u8a18\u3067\u4fdd\u5b58\u3057\u3066\u3044\u308b\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">learn.export()<\/code><\/pre>\n<p>\u4fdd\u5b58\u3057\u305f pkl \u30d5\u30a1\u30a4\u30eb\u3092\u5229\u7528\u3059\u308c\u3070\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3067\u3001\u63a8\u8ad6\u304c\u53ef\u80fd\u3067\u3042\u308b\u3002<\/p>\n<p><a href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20240103a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20240103a.png\" alt=\"\" width=\"622\" height=\"246\" class=\"aligncenter size-full wp-image-12315\" srcset=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20240103a.png 622w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20240103a-300x119.png 300w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/20240103a-600x237.png 600w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/a><\/p>\n<p>\u8a13\u7df4\u306fGPU \u3092\u4f7f\u3063\u3066\u3044\u308b\u3002\u63a8\u8ad6\u306f\u5225\u306e\u30d1\u30bd\u30b3\u30f3\u3067\u5b9f\u65bd\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u3002\u305d\u306e\u5834\u5408\u3001GPU \u3092\u5229\u7528\u3057\u306a\u3044\u304b\u3082\u3057\u308c\u306a\u3044\u3002\u305f\u3060\u3001\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3092\u3001GPU \u3092\u5229\u7528\u3057\u306a\u3044 VirtualBox \u4e0a\u306e ubuntu22 \u3067\u5b9f\u884c\u3059\u308b\u3068\u4e0b\u8a18\u306e\u3088\u3046\u306a\u8b66\u544a\u304c\u6765\u305f\u3002fastbook \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u306b\u3082\u554f\u984c\u304c\u3042\u3063\u305f\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">$ python3 .\/test.py \r\n\/usr\/local\/lib\/python3.10\/dist-packages\/fastai\/torch_core.py:263: UserWarning: 'has_mps' is deprecated, please use 'torch.backends.mps.is_built()'\r\n  return getattr(torch, 'has_mps', False)\r\n('teddy', tensor(2), tensor([1.1100e-05, 2.4582e-05, 9.9996e-01]))<\/code><\/pre>\n<p>mps \u306f GPU \u95a2\u9023\u3089\u3057\u3044\u3002\u305d\u308c\u3068\u5b66\u7fd2\u6e08\u307f\u306e\u30e2\u30c7\u30eb\u306e\u53d6\u308a\u6271\u3044\u306b\u95a2\u3057\u3066\u3001\u8a18\u4e8b\u304c\u3044\u304f\u3064\u304b\u3042\u308b\u3002\u540c\u3058\u3088\u3046\u306a\u3053\u3068\u3092\u307f\u306a\u3055\u3093\u3084\u308d\u3046\u3068\u3057\u3066\u3044\u308b\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/qiita.com\/GesonAnko\/items\/83e08a7274ff63a7c2a5\">M1Mac\u306eGPU\u3067 PyTorch\u52d5\u304f\u305e\uff01<\/a><\/li>\n<li><a href=\"https:\/\/tzmi.hatenablog.com\/entry\/2020\/03\/05\/222813\">Pytorch\u3067\u30e2\u30c7\u30eb\u306e\u4fdd\u5b58\u3068\u8aad\u307f\u8fbc\u307f<\/a><\/li>\n<\/ul>\n<p>\u5f53\u9762\u306f\u3001\u63a8\u8ad6\u306e\u65b9\u306b\u3082 GPU \u3092\u7528\u610f\u3059\u308b\u3053\u3068\u3067\u5bfe\u5fdc\u3057\u3088\u3046\u3068\u601d\u3046\u3002\u305f\u3060\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u305f\u304f\u3055\u3093\u6765\u3066\u6642\u9593\u7684\u306b\u91cd\u306a\u308a\u3001\u3044\u304f\u3064\u304b\u30d1\u30e9\u30ec\u30eb\u306b\u51e6\u7406\u3059\u308b\u3088\u3046\u306a\u5834\u5408\u3001CPU \u51e6\u7406\u306e\u65b9\u304c\u5b89\u5168\u306a\u6c17\u304c\u3059\u308b\u3002<\/p>\n<p><strong>p70 \u3042\u305f\u308a\u3001i5-3000\u756a\u53f0\u3067\u5b9f\u884c\u3057\u305f\u5834\u5408\u306e\u8a71<\/strong><\/p>\n<p>\u5b66\u7fd2\u74b0\u5883\u3092\u5909\u3048\u3066\u3001\u53e4\u3044 core i5-3570, GeForce GTX 1060 6GB \u3067\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\u3068\u8b66\u544a\u304c\u3042\u3063\u305f\u3002<\/p>\n<p><a href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/Screenshot-from-2024-02-22-15-32-57.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/Screenshot-from-2024-02-22-15-32-57.png\" alt=\"\" width=\"937\" height=\"670\" class=\"aligncenter size-full wp-image-12359\" srcset=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/Screenshot-from-2024-02-22-15-32-57.png 937w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/Screenshot-from-2024-02-22-15-32-57-300x215.png 300w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/Screenshot-from-2024-02-22-15-32-57-768x549.png 768w, http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/wp-content\/uploads\/2023\/11\/Screenshot-from-2024-02-22-15-32-57-600x429.png 600w\" sizes=\"auto, (max-width: 937px) 100vw, 937px\" \/><\/a><\/p>\n<p>\u629c\u304d\u51fa\u3059\u3068\u3053\u3093\u306a\u8b66\u544a\u3002 \u5b9f\u884c\u304c\u6b62\u307e\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u3002<\/p>\n<p><code>[W NNPACK.cpp:64] Could not initialize NNPACK! Reason: Unsupported hardware.<\/code><\/p>\n<p>\u78ba\u4fe1\u306f\u306a\u3044\u304c\u3001<a href=\"https:\/\/discuss.pytorch.org\/t\/bug-w-nnpack-cpp-80-could-not-initialize-nnpack-reason-unsupported-hardware\/107518\">\u3053\u3093\u306a\u8a18\u4e8b<\/a>\u304c\u3042\u3063\u305f\u3002CPU \u304c AVX2 \u547d\u4ee4\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u3068\u3044\u3046\u8b66\u544a\u3060\u3068\u306e\u3053\u3068\u3002\u78ba\u304b\u306b\u3053\u306e\u547d\u4ee4\u306f4000\u756a\u53f0\u304b\u3089\u63a1\u7528\u3055\u308c\u3066\u3044\u308b\u3002\u5b9f\u969b\u306b i5-4000 \u756a\u53f0\u306e CPU \u3067\u306f\u8b66\u544a\u304c\u51fa\u306a\u3044\u3002<\/p>\n<p><strong>p188<\/strong><\/p>\n<p>\u672c\u306b\u306f\u30b3\u30fc\u30c9\u306e\u8a18\u8ff0\u304c\u306a\u3044\u304c\u3001\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306b\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u304c\u3042\u308b\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">#hide_input\r\nfrom IPython.display import HTML\r\ndf = pd.DataFrame(sm_acts, columns=[\"3\",\"7\"])\r\ndf['targ'] = targ\r\ndf['idx'] = idx\r\ndf['result'] = sm_acts[range(6), targ]\r\n#t = df.style.hide_index()\r\nt = df.style.hide()\r\n#To have html code compatible with our script\r\nhtml = t._repr_html_().split('&lt;\/style&gt;')[1]\r\nhtml = re.sub(r'&lt;table id=\"([^\"]+)\"\\s*&gt;', r'&lt;table &gt;', html)\r\ndisplay(HTML(html))<\/code><\/pre>\n<p>jinja2 \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u95a2\u3059\u308b\u30a8\u30e9\u30fc\u304c\u751f\u3058\u3066\u3044\u305f\u306e\u3067\u3001jinja2 \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092 3.1.2 \u306b\u5909\u66f4\u3057\u305f\u3002\u3053\u306e\u4ed6\u3001<code>'Styler' object has no attribute 'hide_index'<\/code> \u3068\u3044\u3046\u30a8\u30e9\u30fc\u3082\u3042\u3063\u305f\u3002\u3053\u308c\u306f\u3001<a href=\"https:\/\/stackoverflow.com\/questions\/55051920\/pandas-styler-object-has-no-attribute-hide-index-error\">\u3053\u306e\u30b5\u30a4\u30c8<\/a>\u306b\u3042\u308b\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u305f\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">#t = df.style.hide_index()\r\nt = df.style.hide()<\/code><\/pre>\n<p><strong>p214\u3042\u305f\u308a<\/strong><\/p>\n<p>\u78ba\u5b9a\u7684\u3067\u306f\u306a\u3044\u304c\u3001\u8a18\u9332\u3059\u308b\u3002\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u306b\u95a2\u3057\u3066\u3001<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">loss_func = nn.BCEWithLogitsLoss()\r\nloss = loss_func(activs, y)\r\n<\/code><\/pre>\n<p>\u30a8\u30e9\u30fc\u304c\u751f\u3058\u308b\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">TypeError: no implementation found for 'torch.nn.functional.binary_cross_entropy_with_logits' on types that implement __torch_function__: [<class 'fastai.torch_core.TensorImage'>, <class 'fastai.torch_core.TensorMultiCategory'>]\r\n<\/code><\/pre>\n<p>\u307e\u3063\u305f\u304f\u540c\u3058\u5185\u5bb9\u3068\u3044\u3046\u308f\u3051\u3067\u306f\u306a\u3044\u304c\u3001<a href=\"https:\/\/forums.fast.ai\/t\/typeerror-no-implementation-found-for-torch-nn-functional-smooth-l1-loss-on-types-that-implement-torch-function-class-fastai-torch-core-tensorimage-class-fastai-vision-core-tensorbbox\/90897\/4\">\u3053\u306e\u30b5\u30a4\u30c8<\/a>\u306e\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3057\u3066\u4e0b\u8a18\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u307f\u305f\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">loss_func = nn.BCEWithLogitsLoss()\r\n#loss = loss_func(activs, y)\r\nloss = loss_func(TensorBase(activs), TensorBase(y))\r\nloss\r\n<\/code><\/pre>\n<p>\u51fa\u529b\u306f\u4e0b\u8a18\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">TensorBase(1.0535, grad_fn=&lt;AliasBackward0&gt;)<\/code><\/pre>\n<p>\u672c\u3068\u306f\u7570\u306a\u308b\u51fa\u529b\u3067\u3042\u308b\u3002\u3053\u308c\u3067\u826f\u3044\u304b\u3069\u3046\u304b\u306f\u5206\u304b\u3089\u306a\u3044\u3002<\/p>\n<p><strong>p261<\/strong><\/p>\n<p>dtreeviz \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u3002<\/p>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\">sudo pip install dtreeviz<\/code><\/pre>\n<pre><code style=\"color: midnightblue; font-size: 12px; white-space: pre-wrap;\"><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u300cpytorch\u3068fastai\u3067\u306f\u3058\u3081\u308b\u30c7\u30a3\u30fc\u30d7\u30e9\u30fc\u30cb\u30f3\u30b0\u300d\u3092\u8aad\u3093\u3067\u3044\u304f\u4e0a\u3067\u306e\u6ce8 &#8230; <a class=\"more-link\" href=\"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/?p=12190\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-12190","post","type-post","status-publish","format-standard","hentry","category-column"],"_links":{"self":[{"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/12190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12190"}],"version-history":[{"count":98,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/12190\/revisions"}],"predecessor-version":[{"id":13469,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/12190\/revisions\/13469"}],"wp:attachment":[{"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12190"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zairyo.susi.oita-u.ac.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}