From 746394e79be3c7df0154b8305e36c4914ad5078f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Santill=C3=A1n=20Cooper?= Date: Tue, 26 Nov 2024 11:49:37 -0300 Subject: [PATCH] Add inference engines to the catalog (#1394) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martín Santillán Cooper --- prepare/engines/cross_provider/llama3.py | 13 +++++++++++++ prepare/engines/openai/gpt4o.py | 7 +++++++ prepare/engines/rits/llama3.py | 13 +++++++++++++ .../cross_provider/llama_3_70b_instruct.json | 7 +++++++ .../engines/cross_provider/llama_3_8b_instruct.json | 7 +++++++ src/unitxt/catalog/engines/openai/gpt_4o.json | 6 ++++++ .../catalog/engines/rits/llama_3/1_8b_instruct.json | 6 ++++++ .../engines/rits/llama_3_1_405b_instruct_fp8.json | 6 ++++++ .../engines/rits/llama_3_1_70b_instruct.json | 6 ++++++ 9 files changed, 71 insertions(+) create mode 100644 prepare/engines/cross_provider/llama3.py create mode 100644 prepare/engines/openai/gpt4o.py create mode 100644 prepare/engines/rits/llama3.py create mode 100644 src/unitxt/catalog/engines/cross_provider/llama_3_70b_instruct.json create mode 100644 src/unitxt/catalog/engines/cross_provider/llama_3_8b_instruct.json create mode 100644 src/unitxt/catalog/engines/openai/gpt_4o.json create mode 100644 src/unitxt/catalog/engines/rits/llama_3/1_8b_instruct.json create mode 100644 src/unitxt/catalog/engines/rits/llama_3_1_405b_instruct_fp8.json create mode 100644 src/unitxt/catalog/engines/rits/llama_3_1_70b_instruct.json diff --git a/prepare/engines/cross_provider/llama3.py b/prepare/engines/cross_provider/llama3.py new file mode 100644 index 000000000..4c9786c7e --- /dev/null +++ b/prepare/engines/cross_provider/llama3.py @@ -0,0 +1,13 @@ +from unitxt.catalog import add_to_catalog +from unitxt.inference import CrossProviderInferenceEngine + +model_list = ["meta-llama/llama-3-8b-instruct", "meta-llama/llama-3-70b-instruct"] + +for model in model_list: + model_label = model.split("/")[1].replace("-", "_").replace(".", ",").lower() + inference_model = CrossProviderInferenceEngine( + model=model, provider="watsonx", max_tokens=2048, seed=42 + ) + add_to_catalog( + inference_model, f"engines.cross_provider.{model_label}", overwrite=True + ) diff --git a/prepare/engines/openai/gpt4o.py b/prepare/engines/openai/gpt4o.py new file mode 100644 index 000000000..4dd51a48e --- /dev/null +++ b/prepare/engines/openai/gpt4o.py @@ -0,0 +1,7 @@ +from unitxt.catalog import add_to_catalog +from unitxt.inference import OpenAiInferenceEngine + +model_name = "gpt-4o" +model_label = model_name.replace("-", "_").lower() +inference_model = OpenAiInferenceEngine(model_name=model_name, max_tokens=2048, seed=42) +add_to_catalog(inference_model, f"engines.openai.{model_label}", overwrite=True) diff --git a/prepare/engines/rits/llama3.py b/prepare/engines/rits/llama3.py new file mode 100644 index 000000000..7516d41b4 --- /dev/null +++ b/prepare/engines/rits/llama3.py @@ -0,0 +1,13 @@ +from unitxt.catalog import add_to_catalog +from unitxt.inference import RITSInferenceEngine + +model_list = [ + "meta-llama/Llama-3.1-8B-Instruct", + "meta-llama/llama-3-1-70b-instruct", + "meta-llama/llama-3-1-405b-instruct-fp8", +] + +for model in model_list: + model_label = model.split("/")[1].replace("-", "_").replace(",", "_").lower() + inference_model = RITSInferenceEngine(model_name=model, max_tokens=2048, seed=42) + add_to_catalog(inference_model, f"engines.rits.{model_label}", overwrite=True) diff --git a/src/unitxt/catalog/engines/cross_provider/llama_3_70b_instruct.json b/src/unitxt/catalog/engines/cross_provider/llama_3_70b_instruct.json new file mode 100644 index 000000000..d8671476c --- /dev/null +++ b/src/unitxt/catalog/engines/cross_provider/llama_3_70b_instruct.json @@ -0,0 +1,7 @@ +{ + "__type__": "cross_provider_inference_engine", + "model": "meta-llama/llama-3-70b-instruct", + "provider": "watsonx", + "max_tokens": 2048, + "seed": 42 +} diff --git a/src/unitxt/catalog/engines/cross_provider/llama_3_8b_instruct.json b/src/unitxt/catalog/engines/cross_provider/llama_3_8b_instruct.json new file mode 100644 index 000000000..841f7932a --- /dev/null +++ b/src/unitxt/catalog/engines/cross_provider/llama_3_8b_instruct.json @@ -0,0 +1,7 @@ +{ + "__type__": "cross_provider_inference_engine", + "model": "meta-llama/llama-3-8b-instruct", + "provider": "watsonx", + "max_tokens": 2048, + "seed": 42 +} diff --git a/src/unitxt/catalog/engines/openai/gpt_4o.json b/src/unitxt/catalog/engines/openai/gpt_4o.json new file mode 100644 index 000000000..27acd7774 --- /dev/null +++ b/src/unitxt/catalog/engines/openai/gpt_4o.json @@ -0,0 +1,6 @@ +{ + "__type__": "open_ai_inference_engine", + "model_name": "gpt-4o", + "max_tokens": 2048, + "seed": 42 +} diff --git a/src/unitxt/catalog/engines/rits/llama_3/1_8b_instruct.json b/src/unitxt/catalog/engines/rits/llama_3/1_8b_instruct.json new file mode 100644 index 000000000..2223e0b60 --- /dev/null +++ b/src/unitxt/catalog/engines/rits/llama_3/1_8b_instruct.json @@ -0,0 +1,6 @@ +{ + "__type__": "rits_inference_engine", + "model_name": "meta-llama/Llama-3.1-8B-Instruct", + "max_tokens": 2048, + "seed": 42 +} diff --git a/src/unitxt/catalog/engines/rits/llama_3_1_405b_instruct_fp8.json b/src/unitxt/catalog/engines/rits/llama_3_1_405b_instruct_fp8.json new file mode 100644 index 000000000..11dfdc98d --- /dev/null +++ b/src/unitxt/catalog/engines/rits/llama_3_1_405b_instruct_fp8.json @@ -0,0 +1,6 @@ +{ + "__type__": "rits_inference_engine", + "model_name": "meta-llama/llama-3-1-405b-instruct-fp8", + "max_tokens": 2048, + "seed": 42 +} diff --git a/src/unitxt/catalog/engines/rits/llama_3_1_70b_instruct.json b/src/unitxt/catalog/engines/rits/llama_3_1_70b_instruct.json new file mode 100644 index 000000000..c46389c00 --- /dev/null +++ b/src/unitxt/catalog/engines/rits/llama_3_1_70b_instruct.json @@ -0,0 +1,6 @@ +{ + "__type__": "rits_inference_engine", + "model_name": "meta-llama/llama-3-1-70b-instruct", + "max_tokens": 2048, + "seed": 42 +}