深入学习机器学习中module 'd2l.torch' has no attribute 'train_ch3'报错的问题

Published: 20 Mar 2024 Category: llm

网上搜了下,主要是最新版本和书里的版本不一致的问题,可以到https://github.com/d2l-ai/d2l-zh/blob/master/d2l/torch.py把这个torch.py文件下载下来,到指定的python的库下面把对应文件替换掉就好。

我这边是在./Library/Python/3.8/lib/python/site-packages/d2l/下面

__init__.py jax.py      mxnet.py    tensorflow.py   torch.py

把torch.py文件替换掉就可以了。