Spaces:
Running
Running
File size: 15,652 Bytes
0b07a42 86c5452 0b07a42 f48b842 0b07a42 40be773 0b07a42 29c05f7 0b07a42 95117cd f829331 0b07a42 79d529c 40be773 0b07a42 362448c 0b07a42 f48b842 95117cd 0b07a42 f48b842 95117cd 0b07a42 95117cd 0b07a42 4cb217b f48b842 95117cd 0b07a42 362448c 0b07a42 362448c 0b07a42 95117cd 0b07a42 362448c 0b07a42 40be773 0b07a42 1a7567e 0b07a42 f48b842 95117cd 0b07a42 1a7567e 0b07a42 f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 95117cd f829331 af0f390 95117cd f829331 95117cd f829331 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 af0f390 95117cd f829331 95117cd af0f390 f829331 af0f390 95117cd f829331 95117cd f829331 af0f390 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 95117cd f829331 af0f390 95117cd f829331 95117cd af0f390 f829331 95117cd af0f390 f829331 95117cd af0f390 f829331 95117cd f829331 95117cd af0f390 f829331 95117cd af0f390 f829331 0b07a42 80c27a4 208d4ee 80c27a4 86c5452 80c27a4 86c5452 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
import os
from dataclasses import dataclass
import re
@dataclass(unsafe_hash=True)
class Model(object):
model_display_name: str
model_name: str
api_url: str
provider: str
hourly_cost: int = None
cost_description: str = None
supports_functions: str = False
size_billion_parameters: int = None
cost_per_million_tokens: int = None
cost_per_million_input_tokens: int = None
cost_per_million_output_tokens: int = None
context_length: int = None
selected: bool = False
def __post_init__(self):
self.cost_per_million_input_tokens = self.cost_per_million_input_tokens or self.cost_per_million_tokens
self.cost_per_million_output_tokens = self.cost_per_million_output_tokens or self.cost_per_million_tokens
@property
def cost(self):
if self.cost_description:
return self.cost_description
if self.hourly_cost:
return f"${self.hourly_cost:.2g} / hour"
if self.cost_per_million_tokens:
return f"${self.cost_per_million_tokens:.2g} / 1M tokens"
elif self.cost_per_million_input_tokens and self.cost_per_million_output_tokens:
return f"${self.cost_per_million_input_tokens:.2g} / 1M input tokens, ${self.cost_per_million_output_tokens:.2g} / 1M output tokens"
env = os.environ.get
MODELS = [
# source: https://openai.com/pricing
# converted costs from dollar/1K tokens to dollar/1M for readability and together_ai comparability
Model(
"gpt-3.5-turbo",
"gpt-3.5-turbo",
None,
"OpenAI",
supports_functions=True,
cost_per_million_input_tokens=1,
cost_per_million_output_tokens=2,
# https://learn.microsoft.com/en-us/answers/questions/1356487/what-is-the-exact-maximum-input-tokens-of-azure-gp
context_length=4096,
),
Model(
"gpt-4-turbo",
"gpt-4-1106-preview",
None,
"OpenAI",
supports_functions=True,
cost_per_million_input_tokens=10,
cost_per_million_output_tokens=30,
# https://writesonic.com/blog/gpt-4-turbo-vs-gpt-4
context_length=128_000,
),
Model(
"gpt-4",
"gpt-4",
None,
"OpenAI",
supports_functions=True,
cost_per_million_input_tokens=30,
cost_per_million_output_tokens=60,
context_length=32_000,
),
# source: https://www.together.ai/pricing
Model(
"llama-2-70b-chat",
"together_ai/togethercomputer/llama-2-70b-chat",
None,
"Together AI",
cost_per_million_tokens=0.9,
size_billion_parameters=70,
# https://github.com/facebookresearch/llama/issues/148
context_length=2048,
),
Model(
"Mixtral-8x7B-Instruct-v0.1",
"together_ai/mistralai/Mixtral-8x7B-Instruct-v0.1",
None,
"Together AI",
size_billion_parameters=8 * 7,
cost_per_million_tokens=0.9,
),
# taken from endpoint pages
Model(
"zephyr-7b-beta",
"huggingface/HuggingFaceH4/zephyr-7b-beta",
env("ZEPHYR_7B_BETA_URL"),
"Hugging Face Inference Endpoint",
hourly_cost=1.30,
size_billion_parameters=7,
),
Model(
"Mistral-7B-Instruct-v0.2",
"huggingface/mistralai/Mistral-7B-Instruct-v0.2",
env("MISTRAL_7B_BETA_URL"),
"Hugging Face Inference Endpoint",
hourly_cost=1.30,
size_billion_parameters=7,
selected=True,
),
Model(
"TinyLlama/TinyLlama-1.1B-Chat-v1.0",
"huggingface/TinyLlama/TinyLlama-1.1B-Chat-v1.0",
env("TINY_LLAMA_URL"),
"Hugging Face Inference Endpoint",
hourly_cost=0.60,
size_billion_parameters=1.1,
),
Model(
"gemini-pro",
"gemini-pro",
None,
"Google VertexAI",
# https://ai.google.dev/pricing
cost_description="$0.25 / 1M input characters, $0.5 / 1M output characters (60 queries per minute are free)",
cost_per_million_input_tokens=0.25,
cost_per_million_output_tokens=0.5,
),
Model(
"chat-bison (PaLM 2)",
"chat-bison",
None,
"Google VertexAI",
# https://cloud.google.com/vertex-ai/docs/generative-ai/pricing
cost_per_million_input_tokens=0.25,
cost_per_million_output_tokens=0.5,
# https://ai.google.dev/models/palm
context_length=8196,
),
Model(
"chat-bison-32k (PaLM 2 32K)",
"chat-bison-32k",
None,
"Google VertexAI",
# https://cloud.google.com/vertex-ai/docs/generative-ai/pricing
cost_per_million_input_tokens=0.25,
cost_per_million_output_tokens=0.5,
),
# new models:
Model(
"01-ai Yi Chat (34B)",
"together_ai/zero-one-ai/Yi-34B-Chat",
None,
"Together AI",
context_length=4096,
# selected=True,
),
Model(
"Chronos Hermes (13B)",
"together_ai/Austism/chronos-hermes-13b",
None,
"Together AI",
context_length=2048,
# selected=True,
),
Model(
"Deepseek Coder Instruct (33B)",
"together_ai/deepseek-ai/deepseek-coder-33b-instruct",
None,
"Together AI",
context_length=16384,
),
Model(
"Platypus2 Instruct (70B)",
"together_ai/garage-bAInd/Platypus2-70B-instruct",
None,
"Together AI",
context_length=4096,
),
Model(
"MythoMax-L2 (13B)",
"together_ai/Gryphe/MythoMax-L2-13b",
None,
"Together AI",
context_length=4096,
),
Model(
"Vicuna v1.5 (13B)",
"together_ai/lmsys/vicuna-13b-v1.5",
None,
"Together AI",
context_length=4096,
),
Model(
"Vicuna v1.5 (7B)",
"together_ai/lmsys/vicuna-7b-v1.5",
None,
"Together AI",
context_length=4096,
size_billion_parameters=7,
# selected=True
),
Model(
"Code Llama Instruct (13B)",
"together_ai/codellama/CodeLlama-13b-Instruct-hf",
None,
"Together AI",
context_length=16384,
),
Model(
"Code Llama Instruct (34B)",
"together_ai/codellama/CodeLlama-34b-Instruct-hf",
None,
"Together AI",
context_length=16384,
),
Model(
"Code Llama Instruct (70B)",
"together_ai/codellama/CodeLlama-70b-Instruct-hf",
None,
"Together AI",
context_length=4096,
),
Model(
"Code Llama Instruct (7B)",
"together_ai/codellama/CodeLlama-7b-Instruct-hf",
None,
"Together AI",
size_billion_parameters=7,
context_length=16384,
),
Model(
"LLaMA-2 Chat (13B)",
"together_ai/togethercomputer/llama-2-13b-chat",
None,
"Together AI",
size_billion_parameters=13,
context_length=4096,
),
Model(
"LLaMA-2 Chat (70B)",
"together_ai/togethercomputer/llama-2-70b-chat",
None,
"Together AI",
size_billion_parameters=70,
context_length=4096,
),
Model(
"LLaMA-2 Chat (7B)",
"together_ai/togethercomputer/llama-2-7b-chat",
None,
"Together AI",
size_billion_parameters=7,
context_length=4096,
# selected=True,
),
Model(
"Mistral (7B) Instruct",
"together_ai/mistralai/Mistral-7B-Instruct-v0.1",
None,
"Together AI",
size_billion_parameters=7,
context_length=4096,
),
Model(
"Mistral (7B) Instruct v0.2 (Together AI)",
"together_ai/mistralai/Mistral-7B-Instruct-v0.2",
None,
"Together AI",
size_billion_parameters=7,
context_length=32768,
selected=True,
),
Model(
"Mixtral-8x7B Instruct (46.7B)",
"together_ai/mistralai/Mixtral-8x7B-Instruct-v0.1",
None,
"Together AI",
size_billion_parameters=8 * 7,
context_length=32768,
),
Model(
"Nous Capybara v1.9 (7B)",
"together_ai/NousResearch/Nous-Capybara-7B-V1p9",
None,
"Together AI",
size_billion_parameters=7,
context_length=8192,
),
Model(
"Nous Hermes 2 - Mixtral 8x7B-DPO (46.7B)",
"together_ai/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
None,
"Together AI",
size_billion_parameters=8 * 7,
context_length=32768,
),
Model(
"Nous Hermes 2 - Mixtral 8x7B-SFT (46.7B)",
"together_ai/NousResearch/Nous-Hermes-2-Mixtral-8x7B-SFT",
None,
"Together AI",
size_billion_parameters=8 * 7,
context_length=32768,
),
Model(
"Nous Hermes LLaMA-2 (7B)",
"together_ai/NousResearch/Nous-Hermes-llama-2-7b",
None,
"Together AI",
size_billion_parameters=7,
context_length=4096,
),
Model(
"Nous Hermes Llama-2 (13B)",
"together_ai/NousResearch/Nous-Hermes-Llama2-13b",
None,
"Together AI",
size_billion_parameters=13,
context_length=4096,
),
Model(
"Nous Hermes-2 Yi (34B)",
"together_ai/NousResearch/Nous-Hermes-2-Yi-34B",
None,
"Together AI",
size_billion_parameters=34,
context_length=4096,
),
Model(
"OpenChat 3.5 (7B)",
"together_ai/openchat/openchat-3.5-1210",
None,
"Together AI",
size_billion_parameters=7,
context_length=8192,
),
Model(
"OpenOrca Mistral (7B) 8K",
"together_ai/Open-Orca/Mistral-7B-OpenOrca",
None,
"Together AI",
size_billion_parameters=7,
context_length=8192,
),
Model(
"Qwen-Chat (7B)",
"together_ai/togethercomputer/Qwen-7B-Chat",
None,
"Together AI",
size_billion_parameters=7,
context_length=8192,
),
Model(
"Qwen 1.5 Chat (0.5B)",
"together_ai/Qwen/Qwen1.5-0.5B-Chat",
None,
"Together AI",
size_billion_parameters=0.5,
context_length=32768,
),
Model(
"Qwen 1.5 Chat (1.8B)",
"together_ai/Qwen/Qwen1.5-1.8B-Chat",
None,
"Together AI",
context_length=32768,
size_billion_parameters=1.8,
),
Model(
"Qwen 1.5 Chat (4B)",
"together_ai/Qwen/Qwen1.5-4B-Chat",
None,
"Together AI",
size_billion_parameters=4,
context_length=32768,
),
Model(
"Qwen 1.5 Chat (7B)",
"together_ai/Qwen/Qwen1.5-7B-Chat",
None,
"Together AI",
context_length=32768,
size_billion_parameters=7
# selected=True
),
Model(
"Qwen 1.5 Chat (14B)",
"together_ai/Qwen/Qwen1.5-14B-Chat",
None,
"Together AI",
size_billion_parameters=14,
context_length=32768,
),
Model(
"Qwen 1.5 Chat (72B)",
"together_ai/Qwen/Qwen1.5-72B-Chat",
None,
"Together AI",
context_length=4096,
),
Model(
"Snorkel Mistral PairRM DPO (7B)",
"together_ai/snorkelai/Snorkel-Mistral-PairRM-DPO",
None,
"Together AI",
context_length=32768,
# selected=True,
),
Model(
"Alpaca (7B)",
"together_ai/togethercomputer/alpaca-7b",
None,
"Together AI",
context_length=2048,
),
Model(
"OpenHermes-2-Mistral (7B)",
"teknium/OpenHermes-2-Mistral-7B",
None,
"Together AI",
context_length=8192,
),
Model(
"OpenHermes-2.5-Mistral (7B)",
"together_ai/teknium/OpenHermes-2p5-Mistral-7B",
None,
"Together AI",
context_length=8192,
# selected=True,
),
Model(
"Falcon Instruct (40B)",
"together_ai/togethercomputer/falcon-40b-instruct",
None,
"Together AI",
context_length=2048,
),
Model(
"Falcon Instruct (7B)",
"together_ai/togethercomputer/falcon-7b-instruct",
None,
"Together AI",
context_length=2048,
# selected=True,
),
Model(
"LLaMA-2-7B-32K-Instruct (7B)",
"together_ai/togethercomputer/Llama-2-7B-32K-Instruct",
None,
"Together AI",
context_length=32768,
),
Model(
"RedPajama-INCITE Chat (3B)",
"together_ai/togethercomputer/RedPajama-INCITE-Chat-3B-v1",
None,
"Together AI",
size_billion_parameters=3,
context_length=2048,
),
Model(
"RedPajama-INCITE Chat (7B)",
"together_ai/togethercomputer/RedPajama-INCITE-7B-Chat",
None,
"Together AI",
context_length=2048,
size_billion_parameters=7,
# selected=True,
),
Model(
"StripedHyena Nous (7B)",
"together_ai/togethercomputer/StripedHyena-Nous-7B",
None,
"Together AI",
context_length=32768,
size_billion_parameters=7,
),
Model(
"ReMM SLERP L2 (13B)",
"together_ai/Undi95/ReMM-SLERP-L2-13B",
None,
"Together AI",
context_length=4096,
size_billion_parameters=13,
),
Model(
"Toppy M (7B)",
"together_ai/Undi95/Toppy-M-7B",
None,
"Together AI",
context_length=4096,
size_billion_parameters=7,
),
Model(
"WizardLM v1.2 (13B)",
"together_ai/WizardLM/WizardLM-13B-V1.2",
None,
"Together AI",
context_length=4096,
size_billion_parameters=13,
# selected=True,
),
Model(
"Upstage SOLAR Instruct v1 (11B)",
"together_ai/upstage/SOLAR-10.7B-Instruct-v1.0",
None,
"Together AI",
context_length=4096,
size_billion_parameters=11,
# selected=True,
),
]
MISSING_MEASUREMENTS = ['gpt-3.5-turbo', 'zephyr-7b-beta', 'Mistral-7B-Instruct-v0.2',
'llama-2-70b-chat', 'Mixtral-8x7B-Instruct-v0.1',
'TinyLlama/TinyLlama-1.1B-Chat-v1.0', 'gemini-pro', 'gpt-4-turbo',
'gpt-4', 'chat-bison (PaLM 2)', 'chat-bison-32k (PaLM 2 32K)',
'Vicuna v1.5 (7B)', 'Mistral (7B) Instruct v0.2 (Together AI)',
'01-ai Yi Chat (34B)', 'Chronos Hermes (13B)', 'LLaMA-2 Chat (7B)',
'Qwen 1.5 Chat (7B)', 'Snorkel Mistral PairRM DPO (7B)',
'OpenHermes-2.5-Mistral (7B)', 'Falcon Instruct (7B)',
'RedPajama-INCITE Chat (7B)', 'WizardLM v1.2 (13B)',
'Upstage SOLAR Instruct v1 (11B)']
def together_ai_price(billions_of_parameters):
if billions_of_parameters <= 4:
return 0.1
elif 4.1 <= billions_of_parameters <= 8:
return 0.2
elif 8.1 <= billions_of_parameters <= 21:
return 0.3
elif 21.1 <= billions_of_parameters <= 41:
return 0.8
elif 41 < billions_of_parameters: # <= 70:
return 0.9
for model in MODELS:
if model.model_display_name in MISSING_MEASUREMENTS:
model.selected = True
if model.provider == "Together AI":
pattern = r"\((\d+(\.\d+)?)B\)"
match = re.search(pattern, model.model_display_name)
if match:
number_in_parenthesis = float(match.group(1))
model.size_billion_parameters = number_in_parenthesis
model.cost_per_million_tokens = together_ai_price(model.size_billion_parameters)
model.__post_init__()
|