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

can not covert to pytorch model by using transformers #8

Open
ycat3 opened this issue Sep 11, 2020 · 0 comments
Open

can not covert to pytorch model by using transformers #8

ycat3 opened this issue Sep 11, 2020 · 0 comments

Comments

@ycat3
Copy link

ycat3 commented Sep 11, 2020

export OPENAI_GPT2_CHECKPOINT_PATH=./model/ckpt-301
transformers-cli convert --model_type gpt2 \

--tf_checkpoint $OPENAI_GPT2_CHECKPOINT_PATH
--pytorch_dump_output ./pytorch_dump_output/pytorch_model.bin
--config ./model/model_par.json \

INFO:transformers.modeling_gpt2:Converting TensorFlow checkpoint from /home/mycat/gpt-2-tensorflow2.0/model/ckpt-301
INFO:transformers.modeling_gpt2:Loading TF weight _CHECKPOINTABLE_OBJECT_GRAPH with shape []
Traceback (most recent call last):
File "/home/mycat/.local/bin/transformers-cli", line 11, in
load_entry_point('transformers', 'console_scripts', 'transformers-cli')()
File "/home/mycat/transformers/src/transformers/commands/transformers_cli.py", line 33, in main
service.run()
File "/home/mycat/transformers/src/transformers/commands/convert.py", line 134, in run
convert_gpt2_checkpoint_to_pytorch(self._tf_checkpoint, self._config, self._pytorch_dump_output)
File "/home/mycat/transformers/src/transformers/convert_gpt2_original_tf_checkpoint_to_pytorch.py", line 38, in convert_gpt2_checkpoint_to_pytorch
load_tf_weights_in_gpt2(model, config, gpt2_checkpoint_path)
File "/home/mycat/transformers/src/transformers/modeling_gpt2.py", line 75, in load_tf_weights_in_gpt2
arrays.append(array.squeeze())
AttributeError: 'bytes' object has no attribute 'squeeze'

Probably some attributes are missing in GPT2 model.

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