“NoneType”对象没有与 Conda env 相关的属性“seek”

问题描述 投票: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.

我正在使用

此存储库
中的 file_builder.py

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

我还没有尝试过任何事情,因为我不知道从何开始。

pytorch anaconda
1个回答
0
投票

原来我还没有添加像

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

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