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

Output is not as expected(politeness does not getting transferred) #15

Open
souro opened this issue Mar 22, 2021 · 11 comments
Open

Output is not as expected(politeness does not getting transferred) #15

souro opened this issue Mar 22, 2021 · 11 comments

Comments

@souro
Copy link

souro commented Mar 22, 2021

I have followed your tutorial to generate the output fully. I have not changed a tiny bit. Did whatever has been mentioned in your github tutorial. But not getting the expected output. I have also seen the another open issue same like mine and I have followed your new tutorial but not getting the output as you have mentioned. Please let me know how you can help me to track the issue? As I am doing exactly the same thing you mentioned and same data and all, but still let me know if I have to upload any file from my side to track the issue? Thank you.

Input:
send me the text files.
look into this issue.

Output:
send me copy of the text files.
look forward to looking into this issue.

@chenrq2005
Copy link

@souro I am using the same input as yours, my output for the first sentence was OK, same as the output in the README. But the second one was same as yours.

@madaan
Copy link
Member

madaan commented Apr 5, 2021

Hi,

As you can imagine, there's several places where randomness can play a role (i.e., you might not get the exact same output). Perhaps you can using the pre-trained models https://drive.google.com/drive/folders/1tXLC4WbXc_WLgvQu2mTa3jDe0efZ3dz1.

@souro
Copy link
Author

souro commented Apr 8, 2021

Thank you. Let me check with this.

@souro
Copy link
Author

souro commented Apr 13, 2021

@madaan
Hi,
I tried using the pre-trained model as it is,

but getting the below error,
No such file or directory: 'models/politeness/bpe/en-tagged-tagger.pt'
No such file or directory: 'models/politeness/bpe/en-generated-generator.pt'

so I renamed the pretrained models,
and then getting the below error,

RuntimeError: Error(s) in loading state_dict for Transformer:
size mismatch for embeds.weight: copying a param with shape torch.Size([15762, 512]) from checkpoint, the shape in current model is torch.Size([15761, 512]).
size mismatch for logits.weight: copying a param with shape torch.Size([15762, 512]) from checkpoint, the shape in current model is torch.Size([15761, 512]).
size mismatch for logits.bias: copying a param with shape torch.Size([15762]) from checkpoint, the shape in current model is torch.Size([15761]).

and

RuntimeError: Error(s) in loading state_dict for Transformer:
size mismatch for embeds.weight: copying a param with shape torch.Size([15785, 512]) from checkpoint, the shape in current model is torch.Size([15782, 512]).
size mismatch for logits.weight: copying a param with shape torch.Size([15785, 512]) from checkpoint, the shape in current model is torch.Size([15782, 512]).
size mismatch for logits.bias: copying a param with shape torch.Size([15785]) from checkpoint, the shape in current model is torch.Size([15782]).
BLEU+case.mixed+numrefs.1+smooth.exp+tok.13a+version.1.5.1 = 56.08 100.0/88.9/85.7/80.0 (BP = 0.635 ratio = 0.688 hyp_len = 11 ref_len = 16)

I am using configuration setting as mentioned in this repo without any changes. Can you please let me know if any changes required or not?

@TanmayParekh
Copy link

This seems like there could be a difference between the vocabulary sizes of the loaded model and the initialized model. This could happen if you are initializing the model with the wrong vocabulary size. Could you give more details/code where you initialize the model and load the pre-trained model?

@souro
Copy link
Author

souro commented Apr 13, 2021

@TanmayParekh Thank you for your reply ...
Instructions I am using following the below link (without a single change)
https://github.com/tag-and-generate/tagger-generator#readme

Code I am using (again without a single change) ...
https://github.com/tag-and-generate/tagger-generator

I just have replaced the pretrained model within the location /tagger-generator/tag-and-generate-train/models/politeness/bpe/
and then for testing ran the below command as suggested in your repo:
bash scripts/inference.sh input.txt sample tagged generated politeness P_9 P_9 ../data/ 3

@TanmayParekh
Copy link

Just trying to compare the potential cause for the difference in the vocabs, I want to clarify that you are using the BPE segmentation for words (using the prepare_bpe.sh) script.
I wanted to know what version of the sentencepiece library are you using?

@qyang1021
Copy link

Just trying to compare the potential cause for the difference in the vocabs, I want to clarify that you are using the BPE segmentation for words (using the prepare_bpe.sh) script.
I wanted to know what version of the sentencepiece library are you using?

so which version of sentencepiece shall I use?

@jionghaolin
Copy link

jionghaolin commented Jul 25, 2021

@madaan
Hi,
I tried using the pre-trained model as it is,

but getting the below error,
No such file or directory: 'models/politeness/bpe/en-tagged-tagger.pt'
No such file or directory: 'models/politeness/bpe/en-generated-generator.pt'

so I renamed the pretrained models,
and then getting the below error,

RuntimeError: Error(s) in loading state_dict for Transformer:
size mismatch for embeds.weight: copying a param with shape torch.Size([15762, 512]) from checkpoint, the shape in current model is torch.Size([15761, 512]).
size mismatch for logits.weight: copying a param with shape torch.Size([15762, 512]) from checkpoint, the shape in current model is torch.Size([15761, 512]).
size mismatch for logits.bias: copying a param with shape torch.Size([15762]) from checkpoint, the shape in current model is torch.Size([15761]).

and

RuntimeError: Error(s) in loading state_dict for Transformer:
size mismatch for embeds.weight: copying a param with shape torch.Size([15785, 512]) from checkpoint, the shape in current model is torch.Size([15782, 512]).
size mismatch for logits.weight: copying a param with shape torch.Size([15785, 512]) from checkpoint, the shape in current model is torch.Size([15782, 512]).
size mismatch for logits.bias: copying a param with shape torch.Size([15785]) from checkpoint, the shape in current model is torch.Size([15782]).
BLEU+case.mixed+numrefs.1+smooth.exp+tok.13a+version.1.5.1 = 56.08 100.0/88.9/85.7/80.0 (BP = 0.635 ratio = 0.688 hyp_len = 11 ref_len = 16)

I am using configuration setting as mentioned in this repo without any changes. Can you please let me know if any changes required or not?

@madaan
I met the same issue and I shared my screenshot in here. I followed the instruction https://github.com/tag-and-generate/tagger-generator#readme, replaced the trained models with the pre-trained models, but the terminal raised the errors. I installed the sentencepiece using 'pip install sentencepiece'

@AJR07
Copy link

AJR07 commented Jun 25, 2022

@madaan
Hi, upon replacing the models with the pre-trained models I am also met with the same error. Could it be because of the versions of sentencepiece are different? If so, could you provide us with the version of sentencepiece you are using? Thanks!

@AJR07
Copy link

AJR07 commented Nov 23, 2022

Did you all try sentencepiece version 0.1.91 with Python 3.7.0? Seems to work for me :)

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

7 participants