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

Add support for new models (gpt-4o, o1-preview and o1-mini) #1558

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions evals/elsuite/already_said_that/scripts/make_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def zero_if_none(input_num):
"cot/gpt-3.5-turbo",
"gpt-3.5-turbo",
"gpt-4-base",
"gpt-4o",
"o1-preview",
"o1-mini",
"gemini-pro",
"mixtral-8x7b-instruct",
"llama-2-70b-chat",
Expand All @@ -35,6 +38,9 @@ def zero_if_none(input_num):
"cot/gpt-3.5-turbo",
"gpt-3.5-turbo",
"gpt-4-base",
"gpt-4o",
"o1-preview",
"o1-mini",
]


Expand Down Expand Up @@ -154,6 +160,12 @@ def get_model(spec):
return "gpt-3.5-turbo"
elif "gpt-4-base" in spec["completion_fns"][0]:
return "gpt-4-base"
elif "gpt-4o" in spec["completion_fns"][0]:
return "gpt-4o"
elif "o1-preview" in spec["completion_fns"][0]:
return "o1-preview"
elif "o1-mini" in spec["completion_fns"][0]:
return "o1-mini"
elif "gemini-pro" in spec["completion_fns"][0]:
return "gemini-pro"
elif "mixtral-8x7b-instruct" in spec["completion_fns"][0]:
Expand Down
12 changes: 12 additions & 0 deletions evals/elsuite/track_the_stat/scripts/make_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def zero_if_none(input_num):
MODELS = [
"gpt-4-0125-preview",
"gpt-4-base",
"gpt-4o",
"o1-preview",
"o1-mini",
"gpt-3.5-turbo-0125",
"gemini-pro-1.0",
"mixtral-8x7b-instruct",
Expand All @@ -32,6 +35,9 @@ def zero_if_none(input_num):
"gpt-4-0125-preview",
"gpt-3.5-turbo-0125",
"gpt-4-base",
"gpt-4o",
"o1-preview",
"o1-mini",
]

STAT_TO_LABEL = {
Expand All @@ -54,6 +60,12 @@ def get_model(spec):
return "gpt-3.5-turbo-0125"
elif "gpt-4-base" in spec["completion_fns"][0]:
return "gpt-4-base"
elif "gpt-4o" in spec["completion_fns"][0]:
return "gpt-4o"
elif "o1-preview" in spec["completion_fns"][0]:
return "o1-preview"
elif "o1-mini" in spec["completion_fns"][0]:
return "o1-mini"
elif "gemini-pro" in spec["completion_fns"][0]:
return "gemini-pro-1.0"
elif "mixtral-8x7b-instruct" in spec["completion_fns"][0]:
Expand Down
9 changes: 7 additions & 2 deletions evals/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def n_ctx_from_model_name(model_name: str) -> Optional[int]:
("gpt-3.5-turbo-", 4096),
("gpt-4-32k-", 32768),
("gpt-4-", 8192),
("gpt-4o-", 128_000),
("o1-", 128_000),
]
MODEL_NAME_TO_N_CTX: dict[str, int] = {
"ada": 2048,
Expand All @@ -65,6 +67,9 @@ def n_ctx_from_model_name(model_name: str) -> Optional[int]:
"gpt-4-1106-preview": 128_000,
"gpt-4-turbo-preview": 128_000,
"gpt-4-0125-preview": 128_000,
"gpt-4o": 128_000,
"o1-preview": 128_000,
"o1-mini": 128_000,
}

# first, look for an exact match
Expand All @@ -84,12 +89,12 @@ def is_chat_model(model_name: str) -> bool:
if model_name in {"gpt-4-base"} or model_name.startswith("gpt-3.5-turbo-instruct"):
return False

CHAT_MODEL_NAMES = {"gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4", "gpt-4-32k"}
CHAT_MODEL_NAMES = {"gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4", "gpt-4-32k", "gpt-4o", "o1-preview", "o1-mini"}

if model_name in CHAT_MODEL_NAMES:
return True

for model_prefix in {"gpt-3.5-turbo-", "gpt-4-"}:
for model_prefix in {"gpt-3.5-turbo-", "gpt-4-", "gpt-4o-", "o1-"}:
if model_name.startswith(model_prefix):
return True

Expand Down
6 changes: 6 additions & 0 deletions evals/registry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ def test_n_ctx_from_model_name():
assert n_ctx_from_model_name("gpt-3.5-turbo-0613") == 4096
assert n_ctx_from_model_name("gpt-3.5-turbo-16k") == 16384
assert n_ctx_from_model_name("gpt-3.5-turbo-16k-0613") == 16384
assert n_ctx_from_model_name("gpt-4o") == 128_000
assert n_ctx_from_model_name("o1-preview") == 128_000
assert n_ctx_from_model_name("o1-mini") == 128_000
assert n_ctx_from_model_name("gpt-4") == 8192
assert n_ctx_from_model_name("gpt-4-0613") == 8192
assert n_ctx_from_model_name("gpt-4-32k") == 32768
Expand All @@ -27,6 +30,9 @@ def test_is_chat_model():
assert is_chat_model("gpt-4-0613")
assert is_chat_model("gpt-4-32k")
assert is_chat_model("gpt-4-32k-0613")
assert is_chat_model("gpt-4o")
assert is_chat_model("o1-preview")
assert is_chat_model("o1-mini")
assert not is_chat_model("text-davinci-003")
assert not is_chat_model("gpt4-base")
assert not is_chat_model("code-davinci-002")