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

HuggingFace tokenizer does not pad to max_length? #30

Closed
CQHofsns opened this issue Apr 19, 2024 · 1 comment
Closed

HuggingFace tokenizer does not pad to max_length? #30

CQHofsns opened this issue Apr 19, 2024 · 1 comment

Comments

@CQHofsns
Copy link

Dear VinAI team,

Thank you for sharing your work with us. I tried to use your model (PhoGPT tokenizer) and set the max length to 8192, but the tokenizer's output did not add any padding tokens. Here is an example:

phogpt_tokenizer= AutoTokenizer.from_pretrained("vinai/PhoGPT-4B", trust_remote_code= True)
print(
    phogpt_tokenizer(
        "Đây là câu hỏi",
        max_length= 8192,
        truncation= True,
        padding= True
    )
)

The output is:
{'input_ids': [2985, 270, 1117, 1378], 'attention_mask': [1, 1, 1, 1]}

You can see that the output token list only has 4 tokens. Should it be 8192 tokens instead?

@CQHofsns
Copy link
Author

Sorry my bad, the padding should be set as "padding='max_length'" instead of "padding= True".

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