Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Constitutional AI: Harmlessness from AI Feedback (#154)
* CAI (squashed) Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * bug fix Signed-off-by: shami nisimov <snisimov@nvidia.com> * bug fix Signed-off-by: shami nisimov <snisimov@nvidia.com> * + bug fix. + replace 'ultrachat' with 'sft_datablend_v1' Signed-off-by: shami nisimov <snisimov@nvidia.com> * minor Signed-off-by: shami nisimov <snisimov@nvidia.com> * minor Signed-off-by: shami nisimov <snisimov@nvidia.com> * update cai_flow.png Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * update to CAI.rst Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * update CAI.rst Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * done with 'generate_sl_cai_dataset.py' Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor Signed-off-by: shami nisimov <snisimov@nvidia.com> * update from internal repo Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update CAI.rst Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * minor Signed-off-by: snisimov <snisimov@nvidia.com> * minor Signed-off-by: snisimov <snisimov@nvidia.com> * minor Signed-off-by: snisimov <snisimov@nvidia.com> * minor Signed-off-by: snisimov <snisimov@nvidia.com> * minor Signed-off-by: snisimov <snisimov@nvidia.com> * minor fix Signed-off-by: snisimov <snisimov@nvidia.com> * in CAT.rst, update stage #4 Signed-off-by: snisimov <snisimov@nvidia.com> * CAI.rst, minor change Signed-off-by: snisimov <snisimov@nvidia.com> * CAI.rst, minor update Signed-off-by: snisimov <snisimov@nvidia.com> * CAI.rst, update stage #4 Signed-off-by: snisimov <snisimov@nvidia.com> * minor (typo) Signed-off-by: snisimov <snisimov@nvidia.com> * minor change (rename file extension) Signed-off-by: shami nisimov <snisimov@nvidia.com> * save intermediate data to disk Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * CAI.rst, minor change. Signed-off-by: shami nisimov <snisimov@nvidia.com> * adding BOS-token to the prompt. Signed-off-by: shami nisimov <snisimov@nvidia.com> * minor change Signed-off-by: snisimov <snisimov@nvidia.com> * adding argumnt 'host' for host name (or IP address) of the inference service Signed-off-by: snisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor Signed-off-by: snisimov <snisimov@nvidia.com> * adding argumnt 'host' for host name (or IP address) of the inference service Signed-off-by: snisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * changes to CAI.rst Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * fixes to prev commit + debug comment removal Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * removing unnecessary ++s Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * 1. adding 'remote_inference' unction to utils. 2. parametrize arguments to 'remote_inference' using `parser.add_argument_group.parser.add_argument_group('inference', 'inference (service) arguments')` Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * 1. using 'remote_inference' function (from utils). 2. parametrize arguments to 'remote_inference' using `parser.add_argument_group.parser.add_argument_group('inference', 'inference (service) arguments')` Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor Signed-off-by: shami nisimov <snisimov@nvidia.com> * constitution input as file + some refactor + documentation Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * move ngc inference wrapper to utils.py. Signed-off-by: snisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor (documentation) Signed-off-by: snisimov <snisimov@nvidia.com> * refactor few shot samples Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * small fix to previous commit Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * User guide fix Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * minor fix to previous commit Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * add to 'utils.py' a class to handle prompt template formatting based on user-defined templates Signed-off-by: snisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor (rename rule-names) Signed-off-by: snisimov <snisimov@nvidia.com> * minor (raname 'user'/'assistant' to 'User'/'Assistant') Signed-off-by: shami nisimov <snisimov@nvidia.com> * minor (merged 'UserAssistantPromptTemplate' into 'PromptTemplate') Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor: Replace 'MistralInstructChatTemplate' with 'utils.PromptTemplate' and use parser to define prompt template. Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * restore back class 'UserAssistantPromptTemplate' (in utils.py) Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor (test bug fix) Signed-off-by: shami nisimov <snisimov@nvidia.com> * 1. refactor PromptTemplate and UserAssistantPromptTemplate 2. minor fix with 'prompt_template_config' parser. Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor refactor in Promptemplate/UserAssistantPromptTemplate. Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Refactor: remove 'ChatPromptTemplate' class and utilize 'UserAssistantPromptTemplate' (from utils.py) Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * adding apache license + moving cai utils to utils dir + test skeleton Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * test cai_utils Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * some clarification with CAI.rst Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * refactor: use class 'UserAssistantPromptTemplate' from cai_utils.py. Signed-off-by: snisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor (documantation) Signed-off-by: snisimov <snisimov@nvidia.com> * move cai_utils back to examples/nlp/cai Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixes following feedback by jgerh. Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * minor (in 'prepare_args', change default value for '--add_bos') Signed-off-by: shami nisimov <snisimov@nvidia.com> * local inference service to replace megatron_gpt_eval.py (example script from name) Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update CAI.rst: replace usage of 'megatron_gpt_eval.py' with 'service_inference.py' Signed-off-by: shami nisimov <snisimov@nvidia.com> * In CAI.rst, update step #7 (Inference): add example code for calling the inference service Signed-off-by: shami nisimov <snisimov@nvidia.com> * minor documentation update Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * minor doc update Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * minor (parser, change default value) Signed-off-by: snisimov <snisimov@nvidia.com> * minor (explicitly sets all default values for 'examples/nlp/cai/generate_sl_cai_dataset.py') Signed-off-by: snisimov <snisimov@nvidia.com> * minor (explicitly sets all default values for 'examples/nlp/cai/generate_rl_cai_dataset.py) Signed-off-by: snisimov <snisimov@nvidia.com> * minore (address the special case where the 'judge' model assigns the same index to both 'chosen' and 'rejected' responses) Signed-off-by: snisimov <snisimov@nvidia.com> * update RST (adding missing arguments for training script) Signed-off-by: snisimov <snisimov@nvidia.com> * reverting the documentation back to using megatron_gpt_eval.py following that PR #9354 in NeMo is fixing the issue Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * in remote_inference, adding support for a conversation message in dict format, e.g., [{ "content": "some user message", "role": "User" }] Signed-off-by: snisimov <snisimov@nvidia.com> * apply changes to work with PR #9354 in NeMo (Chat template support for megatron_gpt_eval.py) Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor (update arguments in CAI.rst) Signed-off-by: shami nisimov <snisimov@nvidia.com> * moved to work with PR #9354 in NeMo (Chat template support for megatron_gpt_eval.py). we no longer need this file. Signed-off-by: shami nisimov <snisimov@nvidia.com> * integrated changes from PR #9354 in NeMo (Chat template support for megatron_gpt_eval.py). Signed-off-by: shami nisimov <snisimov@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor Signed-off-by: shami nisimov <snisimov@nvidia.com> * rst bug fix Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * CAI.rst -> cai.rst Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * CAI.rst -> cai.rst also on index.rst Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> * minor comment change Signed-off-by: snisimov <snisimov@nvidia.com> * minor (documentation update) Signed-off-by: shami nisimov <snisimov@nvidia.com> --------- Signed-off-by: Gal Leibovich <gleibovich@nvidia.com> Signed-off-by: shami nisimov <snisimov@nvidia.com> Signed-off-by: snisimov <snisimov@nvidia.com> Co-authored-by: shami nisimov <snisimov@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information