python run_glue.py with the AttributeError: 'NoneType' object has no attribute 'seek'
Author: zhuqunxi
Pull request: no
Labels: name: Need more information

name: wontfix

name: Ex: Sequence Classification

# 🐛 Bug

Traceback (most recent call last):
  File "/gpfs/home/bsub/anaconda3/envs/abc/lib/python3.6/site-packages/torch/serialization.py", line 191, 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 "/gpfs/home/bsub/anaconda3/envs/abc/lib/python3.6/site-packages/transformers/modeling_utils.py", line 659, in from_pretrained
    state_dict = torch.load(resolved_archive_file, map_location="cpu")
  File "/gpfs/home/bsub/anaconda3/envs/abc/lib/python3.6/site-packages/torch/serialization.py", line 387, in load
    return _load(f, map_location, pickle_module, **pickle_load_args)
  File "/gpfs/home/bsub/anaconda3/envs/abc/lib/python3.6/site-packages/torch/serialization.py", line 549, in _load
    _check_seekable(f)
  File "/gpfs/home/bsub/anaconda3/envs/abc/lib/python3.6/site-packages/torch/serialization.py", line 194, in _check_seekable
    raise_err_msg(["seek", "tell"], e)
  File "/gpfs/home/bsub/anaconda3/envs/abc/lib/python3.6/site-packages/torch/serialization.py", line 187, 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 "./examples/text-classification/run_glue.py", line 202, in <module>
    main()
  File "./examples/text-classification/run_glue.py", line 133, in main
    cache_dir=model_args.cache_dir,
  File "/gpfs/home/bsub/anaconda3/envs/abc/lib/python3.6/site-packages/transformers/modeling_auto.py", line 874, in from_pretrained
    return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
  File "/gpfs/home/bsub/anaconda3/envs/abc/lib/python3.6/site-packages/transformers/modeling_utils.py", line 662, in from_pretrained
    "Unable to load weights from pytorch checkpoint file. "
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. 



Comments:
You really need to put more effort in how you ask questions. Just throwing in some error trace and leaving it up to us to figure out what you want or where things go wrong is not the way to go. Use [**code blocks**](https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks) and when using an example script, post your environment (as per the **template**) and post the command that you used.

In your case it seems that you wanted to load a tensorflow model with PyTorch. That won't work. If you need to use Tensorflow models, use [run_tf_glue.py](https://github.com/huggingface/transformers/blob/master/examples/text-classification/run_tf_glue.py) instead.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.


Have you solved it ?