修改代码以适应当前版本的 PyTorch: 由于torch._six 已被移除,你需要找到替代的方式来获取 inf。在 Python 中,inf 是float 类型的一个特殊值,表示正无穷大。你可以直接从 float 类型获取这个值,而不需要依赖 torch._six。 修改后的代码示例如下: python inf = float('inf') 更新PyTorch 到最新版本: 如果你...
from torch._six import inf ModuleNotFoundError: No module named 'torch._six' Please advise. Thank you! Desktop (please complete the following information): OS: Ubuntu 22.04.1 PyTorch version: 2.0.1+cu118; Python 3.9.13 GPU: NVIDIA RTX A5000 * 4 ...
-OS:Ubuntu18.04-Python:3.9-Transformers:4.30.2-PyTorch:2.0.2+cu118-CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`):True Anything else? No response 🚀3LaniakeaS, Linjiahua, and xueyongfu11 reacted with rocket emoji ...
importtorchfromprevious_chaptersimportGPTModelGPT_CONFIG_124M={"vocab_size":50257,# Vocabulary size"context_length":256,# Shortened context length (orig: 1024)"emb_dim":768,# Embedding dimension"n_heads":12,# Number of attention heads"n_layers":12,# Number of layers"drop_rate":0.1,# Drop...