我得到“'NoneType'对象没有属性'seek'”,但它在某种程度上与 conda env 相关

问题描述 投票:0回答:1

我尝试运行一个 python 文件(不是我的),并且发生了这种情况:

Traceback (most recent call last):
  File "/home/fname/.conda/envs/ptsne/lib/python3.7/site-packages/torch/serialization.py", line 348, in _check_seekable
    f.seek(f.tell())
AttributeError: 'NoneType' object has no attribute 'seek'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "file_builder.py", line 29, in <module>
    map_location=dev)
  File "/home/fname/.conda/envs/ptsne/lib/python3.7/site-packages/torch/serialization.py", line 771, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/home/fname/.conda/envs/ptsne/lib/python3.7/site-packages/torch/serialization.py", line 275, in _open_file_like
    return _open_buffer_reader(name_or_buffer)
  File "/home/fname/.conda/envs/ptsne/lib/python3.7/site-packages/torch/serialization.py", line 260, in __init__
    _check_seekable(buffer)
  File "/home/fname/.conda/envs/ptsne/lib/python3.7/site-packages/torch/serialization.py", line 351, in _check_seekable
    raise_err_msg(["seek", "tell"], e)
  File "/home/fname/.conda/envs/ptsne/lib/python3.7/site-packages/torch/serialization.py", line 344, in raise_err_msg
    raise type(e)(msg)
AttributeError: 'NoneType' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead.

存储库:https://github.com/Academich/reaction_space_ptsne,我使用的文件:file_builder.py

这仅仅是因为 conda 还是该文件有问题?怎么解决?

我什么也没尝试,我不知道从何开始。

pytorch anaconda
1个回答
0
投票

结果我没有添加像 --output --device 等命令,这些命令可以在 file_builder.py 代码本身(parser.add_argument(...))中找到。没有关于如何使用这个文件的说明,所以我自己弄清楚了。

© www.soinside.com 2019 - 2024. All rights reserved.