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

AssertionError: ('Pointer shape torch.Size([256]) and array shape (64,) mismatched', torch.Size([256]), (64,)) #23

Open
etetteh opened this issue Nov 25, 2020 · 6 comments

Comments

@etetteh
Copy link

etetteh commented Nov 25, 2020

Getting the following error when converting my ckpt to huggingface's pytorch. I am using the same config file I used for the pretraining.

Traceback (most recent call last):
  File "/home/enoch/dl_repos/transformers/src/transformers/models/electra/convert_electra_original_tf_checkpoint_to_pytorch.py", line 78, in <module>
    args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path, args.discriminator_or_generator
  File "/home/enoch/dl_repos/transformers/src/transformers/models/electra/convert_electra_original_tf_checkpoint_to_pytorch.py", line 43, in convert_tf_checkpoint_to_pytorch
    model, config, tf_checkpoint_path, discriminator_or_generator=discriminator_or_generator
  File "/home/enoch/dl_repos/transformers/src/transformers/models/electra/modeling_electra.py", line 140, in load_tf_weights_in_electra
    ), f"Pointer shape {pointer.shape} and array shape {array.shape} mismatched"
AssertionError: ('Pointer shape torch.Size([256]) and array shape (64,) mismatched', torch.Size([256]), (64,))

Also, coverting other ckpt does start at all except the 1M training step, which is also failing here

@hyunssong
Copy link

were you able to solve this issue?

@etetteh
Copy link
Author

etetteh commented Jan 12, 2022

No, I wasn't able to resolve it

@stefan-it
Copy link
Owner

Could you please give more details e.g. config.json and the exact command for converting (discriminator or generator).

There's one known problem with small generator models (needs a config change).

@hyunssong
Copy link

I think it could be a problem of the config. I was experiencing the same problem, but it was because I was using the small model's config when I was converting the base model. Changed the config and works now.

@zeno17
Copy link

zeno17 commented Feb 2, 2022

@stefan-it could you tell me what the known problem with the small generator entails? Does it have to do with the setting of:
self.generator_hidden_size = 0.25 # frac of discrim hidden size for gen

@stefan-it
Copy link
Owner

It was related to this configuration change (that is needed to convert the model correctly)

google-research/electra#94 (comment)

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

4 participants