-
Notifications
You must be signed in to change notification settings - Fork 986
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
Explicitly specify pad token id when generating tokens #3565
Explicitly specify pad token id when generating tokens #3565
Conversation
c926e10
to
8589658
Compare
supersedes #3535 |
@@ -198,6 +197,16 @@ def load(self) -> bool: | |||
raise ValueError( | |||
f"Unsupported task {self.task}. Please check the supported `task` option." | |||
) | |||
if not self.tokenizer.pad_token: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this is moved to only for the predictor case, for the transformer mode do we still need to apply the padding ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We won't have access to the model to update the vocabulary size. So, Even if we add the pad token we will get an Index out of range
error.
request_two = "my name is teven and i am" | ||
response = asyncio.run(model({"instances": [request_one, request_two]}, headers={})) | ||
assert request_one in response["predictions"][0] | ||
assert request_two in response["predictions"][1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am asserting it this way because the output changes occasionally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can specify the temperature to 0 to get deterministic response
ae81834
to
3b91b2b
Compare
Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
Greetings! CMD to run hf backend run:
cURL request:
Error:
After displaying this error, the runtime freezes and won't take any other requests CC: @johnugeorge |
@sivanantha321 can you help resolve the merge conflict ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
3b91b2b
to
5c00b2e
Compare
/rerun-all |
/rerun-workflow test-llm |
/rerun-workflow E2E Tests |
/rerun-all |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sivanantha321, spolti, yuzisun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
* Add fall back pad token for tokenizer Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com> * Make linter happy Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com> * Update test Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com> * Rebase master Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com> --------- Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com> Signed-off-by: asd981256 <asd981256@gmail.com>
What this PR does / why we need it:
We have added a fallback pad token if it is not already present in the tokenizer as part of the PR #3459. But it does not explicitly specifies pad_token_id when invoking generate method which leads to huggingface using eos_token_id as the pad_token_id. The log from huggingface server is show below. To avoid this we should explicitly specify the pad_token_id
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #3536
Type of changes
Please delete options that are not relevant.
Feature/Issue validation/testing:
Please describe the tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.
Test A
Test B
Logs
Special notes for your reviewer:
Checklist:
Release note: