forked from openvinotoolkit/openvino.genai
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add python samples #21
Closed
Wovchena
wants to merge
70
commits into
pavel-esir:generate_pipeline
from
Wovchena:add-beam_search_causal_lm.py
Closed
Add python samples #21
Wovchena
wants to merge
70
commits into
pavel-esir:generate_pipeline
from
Wovchena:add-beam_search_causal_lm.py
Commits on Jun 5, 2024
-
Configuration menu - View commit details
-
Copy full SHA for e1502d6 - Browse repository at this point
Copy the full SHA e1502d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for f45221f - Browse repository at this point
Copy the full SHA f45221fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 767db1f - Browse repository at this point
Copy the full SHA 767db1fView commit details -
Configuration menu - View commit details
-
Copy full SHA for caa7438 - Browse repository at this point
Copy the full SHA caa7438View commit details -
Configuration menu - View commit details
-
Copy full SHA for aed5b37 - Browse repository at this point
Copy the full SHA aed5b37View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7e4abad - Browse repository at this point
Copy the full SHA 7e4abadView commit details -
Configuration menu - View commit details
-
Copy full SHA for e190226 - Browse repository at this point
Copy the full SHA e190226View commit details -
Configuration menu - View commit details
-
Copy full SHA for 13977be - Browse repository at this point
Copy the full SHA 13977beView commit details -
Configuration menu - View commit details
-
Copy full SHA for 14deab1 - Browse repository at this point
Copy the full SHA 14deab1View commit details -
Configuration menu - View commit details
-
Copy full SHA for c694770 - Browse repository at this point
Copy the full SHA c694770View commit details -
Configuration menu - View commit details
-
Copy full SHA for 63956a5 - Browse repository at this point
Copy the full SHA 63956a5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 782642e - Browse repository at this point
Copy the full SHA 782642eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5eec344 - Browse repository at this point
Copy the full SHA 5eec344View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0d40c5a - Browse repository at this point
Copy the full SHA 0d40c5aView commit details -
Configuration menu - View commit details
-
Copy full SHA for ff28df5 - Browse repository at this point
Copy the full SHA ff28df5View commit details
Commits on Jun 6, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 1b57c47 - Browse repository at this point
Copy the full SHA 1b57c47View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6da2340 - Browse repository at this point
Copy the full SHA 6da2340View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5abb994 - Browse repository at this point
Copy the full SHA 5abb994View commit details -
Configuration menu - View commit details
-
Copy full SHA for b6a0808 - Browse repository at this point
Copy the full SHA b6a0808View commit details -
Configuration menu - View commit details
-
Copy full SHA for 24819d2 - Browse repository at this point
Copy the full SHA 24819d2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6c893fe - Browse repository at this point
Copy the full SHA 6c893feView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5839264 - Browse repository at this point
Copy the full SHA 5839264View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7da29c6 - Browse repository at this point
Copy the full SHA 7da29c6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 557baa9 - Browse repository at this point
Copy the full SHA 557baa9View commit details -
Configuration menu - View commit details
-
Copy full SHA for f0bdeff - Browse repository at this point
Copy the full SHA f0bdeffView commit details -
Configuration menu - View commit details
-
Copy full SHA for a308424 - Browse repository at this point
Copy the full SHA a308424View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8027e15 - Browse repository at this point
Copy the full SHA 8027e15View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6c64941 - Browse repository at this point
Copy the full SHA 6c64941View commit details -
Configuration menu - View commit details
-
Copy full SHA for 59bd1fa - Browse repository at this point
Copy the full SHA 59bd1faView commit details -
Configuration menu - View commit details
-
Copy full SHA for a71e60a - Browse repository at this point
Copy the full SHA a71e60aView commit details -
Configuration menu - View commit details
-
Copy full SHA for b6ed8d4 - Browse repository at this point
Copy the full SHA b6ed8d4View commit details -
Configuration menu - View commit details
-
Copy full SHA for d1910ef - Browse repository at this point
Copy the full SHA d1910efView commit details -
Configuration menu - View commit details
-
Copy full SHA for 16eca6d - Browse repository at this point
Copy the full SHA 16eca6dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 338038a - Browse repository at this point
Copy the full SHA 338038aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 34342fe - Browse repository at this point
Copy the full SHA 34342feView commit details -
Configuration menu - View commit details
-
Copy full SHA for 833a301 - Browse repository at this point
Copy the full SHA 833a301View commit details
Commits on Jun 7, 2024
-
Configuration menu - View commit details
-
Copy full SHA for d273912 - Browse repository at this point
Copy the full SHA d273912View commit details -
Configuration menu - View commit details
-
Copy full SHA for fbb6d86 - Browse repository at this point
Copy the full SHA fbb6d86View commit details -
Configuration menu - View commit details
-
Copy full SHA for 065d15b - Browse repository at this point
Copy the full SHA 065d15bView commit details -
Configuration menu - View commit details
-
Copy full SHA for e659fb8 - Browse repository at this point
Copy the full SHA e659fb8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 476f67f - Browse repository at this point
Copy the full SHA 476f67fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7fc6b59 - Browse repository at this point
Copy the full SHA 7fc6b59View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8e53f42 - Browse repository at this point
Copy the full SHA 8e53f42View commit details -
Configuration menu - View commit details
-
Copy full SHA for deb543f - Browse repository at this point
Copy the full SHA deb543fView commit details -
Configuration menu - View commit details
-
Copy full SHA for aa21014 - Browse repository at this point
Copy the full SHA aa21014View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8c4b7a1 - Browse repository at this point
Copy the full SHA 8c4b7a1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 66dc3cb - Browse repository at this point
Copy the full SHA 66dc3cbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5c4fc77 - Browse repository at this point
Copy the full SHA 5c4fc77View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3f7e9de - Browse repository at this point
Copy the full SHA 3f7e9deView commit details -
Configuration menu - View commit details
-
Copy full SHA for 61dec7c - Browse repository at this point
Copy the full SHA 61dec7cView commit details -
Configuration menu - View commit details
-
Copy full SHA for a8726e0 - Browse repository at this point
Copy the full SHA a8726e0View commit details -
Configuration menu - View commit details
-
Copy full SHA for dd6d19a - Browse repository at this point
Copy the full SHA dd6d19aView commit details -
Configuration menu - View commit details
-
Copy full SHA for ed65cfb - Browse repository at this point
Copy the full SHA ed65cfbView commit details -
Configuration menu - View commit details
-
Copy full SHA for cbec967 - Browse repository at this point
Copy the full SHA cbec967View commit details -
Configuration menu - View commit details
-
Copy full SHA for e01295f - Browse repository at this point
Copy the full SHA e01295fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6977510 - Browse repository at this point
Copy the full SHA 6977510View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1e8a17e - Browse repository at this point
Copy the full SHA 1e8a17eView commit details -
Configuration menu - View commit details
-
Copy full SHA for bba9b89 - Browse repository at this point
Copy the full SHA bba9b89View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ec3e07 - Browse repository at this point
Copy the full SHA 8ec3e07View commit details -
Configuration menu - View commit details
-
Copy full SHA for 38fbe6b - Browse repository at this point
Copy the full SHA 38fbe6bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9c3eac1 - Browse repository at this point
Copy the full SHA 9c3eac1View commit details -
Configuration menu - View commit details
-
Copy full SHA for ae3555e - Browse repository at this point
Copy the full SHA ae3555eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4faba69 - Browse repository at this point
Copy the full SHA 4faba69View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5f55850 - Browse repository at this point
Copy the full SHA 5f55850View commit details
Commits on Jun 10, 2024
-
Generate pipeline (openvinotoolkit#334)
LLM return logits with probabilities of each token, these probabilities can be converted to tokens/words with different technics: greedy decoding, beam search decoding, random sampling, etc. This requires writing user unfriendly post-processing even for the simplest scenario of greedy decoding. In order to make live easier we we combined all decoding scenarios into a single function call, where the decoding method and parameters are specified by arguments. In this PR we provide a user friendly API for text generation inspired by `generate` method from HuggingFace transformers library. - [x] enable calling tokenizers/detokenizers from LLMPipeline - [ ] add callback for streaming mode - done partially, need to improve - [x] rewritten samples with the current approach: [causal_lm/cpp/generate_pipeline/generate_sample.cpp#L73-L83](https://github.com/pavel-esir/openvino.genai/blob/generate_pipeline/text_generation/causal_lm/cpp/generate_pipeline/generate_sample.cpp#L73-L83) - [x] Multibatch greedy decoding - [ ] Speculative decoding - [ ] Grouped Beam Search decoding: ready for batch 1, need to rebase multibatch support after merging openvinotoolkit#349 - [x] Random sampling Example 1: Greedy search generation ``` LLMPipeline pipe(model_path, device); // Will try to load config from generation_config.json. // but if not found default velues for gready search will be used GenerationConfig config = pipe.generation_config(); cout << pipe(prompt, config.max_new_tokens(20)); ``` Example 2: TextStreaming mode ``` LLMPipeline pipe(model_path, device); GenerationConfig config = pipe.generation_config(); auto text_streamer = TextStreamer{pipe}; auto text_streamer_callback = [&text_streamer](std::vector<int64_t>&& tokens, LLMPipeline& pipe){ text_streamer.put(tokens[0]); }; pipe(prompt, config.max_new_tokens(20).set_callback(text_streamer_callback)); text_streamer.end(); ``` CVS-132907 CVS-137920 --------- Co-authored-by: Wovchena <vladimir.zlobin@intel.com> Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com> Co-authored-by: Alexander Suvorov <alexander.suvorov@intel.com> Co-authored-by: Yaroslav Tarkan <yaroslav.tarkan@intel.com> Co-authored-by: Xiake Sun <xiake.sun@intel.com> Co-authored-by: wenyi5608 <93560477+wenyi5608@users.noreply.github.com> Co-authored-by: Ekaterina Aidova <ekaterina.aidova@intel.com> Co-authored-by: guozhong wang <guozhong.wang@intel.com> Co-authored-by: Chen Peter <peter.chen@intel.com>
Configuration menu - View commit details
-
Copy full SHA for fe265ec - Browse repository at this point
Copy the full SHA fe265ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for 26c3c40 - Browse repository at this point
Copy the full SHA 26c3c40View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0abcb61 - Browse repository at this point
Copy the full SHA 0abcb61View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ecb3bd - Browse repository at this point
Copy the full SHA 8ecb3bdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 04dd619 - Browse repository at this point
Copy the full SHA 04dd619View commit details -
Configuration menu - View commit details
-
Copy full SHA for 29e4258 - Browse repository at this point
Copy the full SHA 29e4258View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.