huggingface / transfer-learning-conv-ai

🦄 State-of-the-Art Conversational AI with Transfer Learning
MIT License
1.74k stars 430 forks source link

Train.py not working #115

Open HadiAskari opened 2 years ago

HadiAskari commented 2 years ago

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.