Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Train.py not working #115

Open
HadiAskari opened this issue Nov 1, 2021 · 0 comments
Open

Train.py not working #115

HadiAskari opened this issue Nov 1, 2021 · 0 comments

Comments

@HadiAskari
Copy link

HadiAskari commented Nov 1, 2021

When I run the following command "python train.py --model="gpt2"" I keep getting the following error.

INFO:transformers.modeling_utils:loading weights file https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-pytorch_model.bin from cache at None
Traceback (most recent call last):
File "/home/haskari/.local/lib/python3.9/site-packages/torch/serialization.py", line 308, 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 "/home/haskari/.local/lib/python3.9/site-packages/transformers/modeling_utils.py", line 470, in from_pretrained
state_dict = torch.load(resolved_archive_file, map_location="cpu")
File "/home/haskari/.local/lib/python3.9/site-packages/torch/serialization.py", line 594, in load
with _open_file_like(f, 'rb') as opened_file:
File "/home/haskari/.local/lib/python3.9/site-packages/torch/serialization.py", line 235, in _open_file_like
return _open_buffer_reader(name_or_buffer)
File "/home/haskari/.local/lib/python3.9/site-packages/torch/serialization.py", line 220, in init
_check_seekable(buffer)
File "/home/haskari/.local/lib/python3.9/site-packages/torch/serialization.py", line 311, in _check_seekable
raise_err_msg(["seek", "tell"], e)
File "/home/haskari/.local/lib/python3.9/site-packages/torch/serialization.py", line 304, 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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/mnt/data0/haskari/transfer-learning-conv-ai/train.py", line 267, in
train()
File "/mnt/data0/haskari/transfer-learning-conv-ai/train.py", line 157, in train
model = model_class.from_pretrained(args.model_checkpoint)
File "/home/haskari/.local/lib/python3.9/site-packages/transformers/modeling_utils.py", line 472, in from_pretrained
raise OSError(
OSError: Unable to load weights from pytorch checkpoint file. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant