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

[Good First Issue]: causal_lm/cpp must read EOS token value from rt_info of openvino_tokenizer.xml #277

Closed
p-wysocki opened this issue Mar 1, 2024 · 12 comments · Fixed by #315
Assignees
Labels
good first issue Good for newcomers

Comments

@p-wysocki
Copy link
Collaborator

p-wysocki commented Mar 1, 2024

Context

End Of Sequence tokens are an essential part of LLM training and inference. You can find more details in this comment.

Thanks to a PR adding End Of Sequence tokens to Runtime Info openvino_tokenizers now put EOS token value into rt_info section in OpenVINO Intermediate Representation format (.xml file to be specific) when converting a tokenizer to OpenVINO.

Since EOS has been enabled in OpenVINO, now it needs to be enabled in GenAI text_generation module.

What needs to be done?

beam_search_causal_lm.cpp and greedy_causal_lm.cpp from https://github.com/openvinotoolkit/openvino.genai/tree/master/text_generation/causal_lm/cpp should read the EOS token instead of having a hardcoded value with comment // There's no way to extract special token values from the detokenizer for now.

It’s required to extract the value using ov::Model::get_rt_info() and use it. Remove the comments about absence of way to extract that value.

Example Pull Requests

Resources

Contact points

@pavel-esir

Ticket

132861

@p-wysocki p-wysocki added the good first issue Good for newcomers label Mar 1, 2024
@github-project-automation github-project-automation bot moved this to Contributors Needed in Good first issues Mar 1, 2024
@anzr299
Copy link
Contributor

anzr299 commented Mar 2, 2024

.take

@p-wysocki
Copy link
Collaborator Author

Hello @anzr299, the ticket will be manually assigned to you shortly - the take feature hasn't been introduced to GenAI repo yet, but it will be today. :)

Thanks for taking a look at the issue!

@p-wysocki p-wysocki moved this from Contributors Needed to Assigned in Good first issues Mar 4, 2024
@p-wysocki
Copy link
Collaborator Author

Hello @anzr299, are you still working on this? Is there anything we could help you with?

@anzr299
Copy link
Contributor

anzr299 commented Mar 16, 2024

Hi, I am still working on it, was busy the past few days.

@anzr299
Copy link
Contributor

anzr299 commented Mar 20, 2024

I've created a PR #315

@anzr299
Copy link
Contributor

anzr299 commented Mar 20, 2024

I have a small question, in beam_search_casual_lm.cpp, the following lines check for an empty token and not the hardcoded EOS token. Should I change this as well to check for the EOS token?
if (next_tokens.empty()) { break; }
(lines 60-62)

@p-wysocki p-wysocki linked a pull request Mar 21, 2024 that will close this issue
@p-wysocki p-wysocki moved this from Assigned to In Review in Good first issues Mar 21, 2024
@p-wysocki
Copy link
Collaborator Author

cc @pavel-esir

@pavel-esir
Copy link
Contributor

I have a small question, in beam_search_casual_lm.cpp, the following lines check for an empty token and not the hardcoded EOS token. Should I change this as well to check for the EOS token? if (next_tokens.empty()) { break; } (lines 60-62)

good question! No need to update beam_searcher, just initialize it with eos token you got from IR in the sample. Please look my comments in you PR.

ilya-lavrenov pushed a commit that referenced this issue Apr 9, 2024
*Details:* Made*changes to accommodate the dynamic EOS Token
*Tickets:*  #277 132861
@github-project-automation github-project-automation bot moved this from In Review to Closed in Good first issues Apr 9, 2024
@anzr299
Copy link
Contributor

anzr299 commented Apr 9, 2024

@ilya-lavrenov The issue asked to add a functionality to read EOS tokens only for beam_search_causal_lm and greedy_causal_lm but not for speculative_decoding_lm. I followed the requirement in my work but I thought it could be better if I added the functionality to speculative_decoding_lm too. Is that alright?

@ilya-lavrenov
Copy link
Contributor

I followed the requirement in my work but I thought it could be better if I added the functionality to speculative_decoding_lm too. Is that alright?

Yes, let's handle this sample as well.
The initial requirements were added before the speculative_decoding_lm sample is implemented.

@anzr299
Copy link
Contributor

anzr299 commented Apr 9, 2024

I followed the requirement in my work but I thought it could be better if I added the functionality to speculative_decoding_lm too. Is that alright?

Yes, let's handle this sample as well. The initial requirements were added before the speculative_decoding_lm sample is implemented.

Sure, I will create a new PR

@anzr299
Copy link
Contributor

anzr299 commented Apr 9, 2024

@ilya-lavrenov I've created a PR at #353

ilya-lavrenov pushed a commit that referenced this issue Apr 11, 2024
…g_lm (#353)

Extension to issue #277, Added the functionality to read EOS token from
model runtime information in the speculative_decoding_lm.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants