akanyaani/gpt-2-tensorflow2.0

can not covert to pytorch model by using transformers

ycat3 opened this issue · 0 comments

ycat3 commented

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.