-
Notifications
You must be signed in to change notification settings - Fork 51
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
Remove IBM GenAI support and moved legacy GenAI metrics to use CrossProviderInferenceEngine #1508
Open
yoavkatz
wants to merge
11
commits into
main
Choose a base branch
from
remove_genai_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+201
−620
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
afa49ca
Remove genai support after service was sunset
yoavkatz fa2ed9a
Merge branch 'main' into remove_genai_support
yoavkatz b4be9c1
Updated catalog
yoavkatz 10d4789
Moved to use CrossProviderInferenceEngine instead of WML or BAM
yoavkatz a2adf08
Merge remote-tracking branch 'origin/main' into remove_genai_support
yoavkatz 114c519
Removed GA
yoavkatz 51329cc
Moved llamguard from genai to cross provider inference engine
yoavkatz 12642c7
Made cataog consistent
yoavkatz 7244bdd
changed table2text rating metric to follow other's conventions
yoavkatz a9f6436
Merge remote-tracking branch 'origin/main' into remove_genai_support
yoavkatz c8ef496
Merge remote-tracking branch 'origin/main' into remove_genai_support
yoavkatz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
prepare/metrics/llm_as_judge/rating/llama_3_generic_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from unitxt import add_to_catalog | ||
from unitxt.inference import CrossProviderInferenceEngine | ||
from unitxt.llm_as_judge_from_template import LLMAsJudge | ||
|
||
inference_model = CrossProviderInferenceEngine( | ||
model="llama-3-70b-instruct", max_tokens=252 | ||
) | ||
|
||
metric = LLMAsJudge( | ||
inference_model=inference_model, | ||
template="templates.response_assessment.rating.generic_single_turn", | ||
task="rating.single_turn", | ||
format="formats.chat_api", | ||
main_score="llama_3_70b_instruct_template_generic_single_turn", | ||
prediction_type=str, | ||
) | ||
|
||
add_to_catalog( | ||
metric, | ||
"metrics.llm_as_judge.rating.llama_3_70b_instruct.generic_single_turn", | ||
overwrite=True, | ||
) | ||
|
||
metric = LLMAsJudge( | ||
inference_model=inference_model, | ||
template="templates.response_assessment.rating.generic_single_turn_with_reference", | ||
task="rating.single_turn_with_reference", | ||
format="formats.chat_api", | ||
single_reference_per_prediction=True, | ||
main_score="llama_3_70b_instruct_template_generic_single_turn_with_reference", | ||
) | ||
|
||
add_to_catalog( | ||
metric, | ||
"metrics.llm_as_judge.rating.llama_3_70b_instruct.generic_single_turn_with_reference", | ||
overwrite=True, | ||
) |
75 changes: 0 additions & 75 deletions
75
prepare/metrics/llm_as_judge/rating/llama_3_ibm_genai_generic_template.py
This file was deleted.
Oops, something went wrong.
18 changes: 9 additions & 9 deletions
18
...ng/llama_3_ibm_genai_mt_bench_template.py → ...judge/rating/llama_3_mt_bench_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
from unitxt import add_to_catalog | ||
from unitxt.inference import IbmGenAiInferenceEngine | ||
from unitxt.inference import CrossProviderInferenceEngine | ||
from unitxt.llm_as_judge_from_template import LLMAsJudge | ||
from unitxt.random_utils import get_seed | ||
|
||
model_list = ["meta-llama/llama-3-8b-instruct", "meta-llama/llama-3-70b-instruct"] | ||
format = "formats.llama3_instruct" | ||
model_list = ["llama-3-70b-instruct", "llama-3-8b-instruct"] | ||
format = "formats.chat_api" | ||
template = "templates.response_assessment.rating.mt_bench_single_turn" | ||
task = "rating.single_turn" | ||
|
||
|
||
for model_id in model_list: | ||
inference_model = IbmGenAiInferenceEngine( | ||
model_name=model_id, max_new_tokens=252, random_seed=get_seed() | ||
inference_model = CrossProviderInferenceEngine( | ||
model=model_id, max_tokens=252, seed=get_seed() | ||
) | ||
model_label = model_id.split("/")[1].replace("-", "_").replace(".", ",").lower() | ||
model_label = f"{model_label}_ibm_genai" | ||
model_label = model_id.replace("-", "_").replace(".", ",").lower() | ||
template_label = template.split(".")[-1] | ||
metric_label = f"{model_label}_template_{template_label}" | ||
metric = LLMAsJudge( | ||
inference_model=inference_model, | ||
template=template, | ||
task=task, | ||
format=format, | ||
format="formats.chat_api", | ||
main_score=metric_label, | ||
prediction_type=str, | ||
) | ||
|
||
add_to_catalog( | ||
metric, | ||
f"metrics.llm_as_judge.rating.{model_label}_template_{template_label}", | ||
f"metrics.llm_as_judge.rating.{model_label}.{template_label}", | ||
overwrite=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
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.
@elronbandel @ShirApp - Please see the change in metric name I made to make table2text rating be consistent with other rating engine. As far as I saw the only use was in scigen.py.
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.
It looks fine. Yes, we used it only for scigen.