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: dimension is not of square shape. #7

Open
Pranjal-Gupta2 opened this issue Jun 18, 2022 · 5 comments
Open

AssertionError: dimension is not of square shape. #7

Pranjal-Gupta2 opened this issue Jun 18, 2022 · 5 comments

Comments

@Pranjal-Gupta2
Copy link

Hi,
I am trying to run your code but it is giving me this error:

Iteration:   0%|                                                                                                                       | 0/3110 [00:00<?, ?it/s]
Epoch:   0%|                                                                                                                              | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "src/container.py", line 732, in <module>
    main()
  File "src/container.py", line 649, in main
    global_step, tr_loss = train(args, train_dataset, model)
  File "src/container.py", line 140, in train
    outputs = model(**inputs)
  File "/u/pranjalgupta/.local/share/virtualenvs/CONTaiNER-y1BOzUqP/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/dccstor/pranjalgupta2/CONTaiNER/src/utils.py", line 191, in forward
    loss = calculate_KL_or_euclidean(self, attention_mask, original_embedding_mu,
  File "/dccstor/pranjalgupta2/CONTaiNER/src/utils.py", line 115, in calculate_KL_or_euclidean
    assert len(repeated_labels) == (filtered_instances_nos * filtered_instances_nos), "dimension is not of square shape."
AssertionError: dimension is not of square shape.

Steps to reproduce:

  1. Download the dataset using dataset.sh
  2. Run process_fewnerd.sh script
  3. Uncomment ## training with toy evaluation for sanity check section in exec_container.sh script
  4. Run exec_container.sh script with the intra 0 5 5 as command line arguments

Can you please help me in resolving this error? Thanks!

@Heihaierr
Copy link

I am facing the same error. It seems "len(repeated_labels) ==(filtered_instances_nos * filtered_instances_nos)" is not reasonable, can you explain why "#ensure that the vector sizes are of filtered_instances_nos * filtered_instances_nos"?

@mayubo2333
Copy link

Hi, I am facing the same error too. Have you solved this problem?

@mayubo2333
Copy link

Hi, I am facing the same error too. Have you solved this problem?

I find a solution to run this code.

  1. delete the assertion command in line 115.
  2. change x.view(filtered_instances_nos, filtered_instances_nos) to x.view(filtered_instances_nos, len(output_embedding_mu)) in line 129 - line 131.

@ywm-up
Copy link

ywm-up commented Dec 3, 2022

Hi, I am facing the same error too. Have you solved this problem?

I find a solution to run this code.

  1. delete the assertion command in line 115.
  2. change x.view(filtered_instances_nos, filtered_instances_nos) to x.view(filtered_instances_nos, len(output_embedding_mu)) in line 129 - line 131.

It works for me, thank you for your solution.

@gangtie95
Copy link

Hi, I am facing the same error too. Have you solved this problem?

I find a solution to run this code.

  1. delete the assertion command in line 115.
  2. change x.view(filtered_instances_nos, filtered_instances_nos) to x.view(filtered_instances_nos, len(output_embedding_mu)) in line 129 - line 131.

Thank you for your solution. It is works.

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

5 participants