YutaroOgawa / pytorch_advanced

書籍「つくりながら学ぶ! PyTorchによる発展ディープラーニング」の実装コードを配置したリポジトリです
MIT License
837 stars 336 forks source link

2-8_SSD_inference_appendix.ipynbのエラーについて #198

Open insilicomab opened 2 years ago

insilicomab commented 2 years ago

# 結果の描画 ssd = SSDPredictShow(img_list=train_img_list, dataset=train_dataset, eval_categories=voc_classes, net=net, dataconfidence_level=0.6) img_index = 0 ssd.show(img_index, "predict") ssd.show(img_index, "ans")

を実行すると以下のようなエラーが出ます。

`--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last)

in () 6 net=net, dataconfidence_level=0.6) 7 img_index = 0 ----> 8 ssd.show(img_index, "predict") 9 ssd.show(img_index, "ans") 4 frames /usr/local/lib/python3.7/dist-packages/torch/autograd/function.py in __call__(self, *args, **kwargs) 260 def __call__(self, *args, **kwargs): 261 raise RuntimeError( --> 262 "Legacy autograd function with non-static forward method is deprecated. " 263 "Please use new-style autograd function with static forward method. " 264 "(Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)") RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)` エラーを解決できずに困っております。よろしくお願いいたします。
YutaroOgawa commented 2 years ago

@insilicomab さま

ご連絡ありがとうございます。 本書を執筆してから時間が経過し、いろいろとバージョン(とくにPyTorchのバージョン)に依存したエラーが発生するようになっています。

上記いただいた内容は、以下のIssueと同じ現象かもしれないと思いました。 一度これらでの解決策を試していただけますでしょうか?

https://github.com/YutaroOgawa/pytorch_advanced/issues/194

https://github.com/YutaroOgawa/pytorch_advanced/issues/74

https://github.com/YutaroOgawa/pytorch_advanced/issues/71

お手数をおかけしますが、どうぞよろしくお願い致します

coderjoonwoo commented 2 years ago

I am having exactly same problem with torch version 1.10.2. It appears no solution for this was posted here yet.

bhkim003 commented 7 months ago

I could not fix this problem too.