From 0dc7c5483cbed4e588238bae8073871efca8c4b3 Mon Sep 17 00:00:00 2001 From: SilasMarvin <19626586+SilasMarvin@users.noreply.github.com> Date: Tue, 25 Jun 2024 10:30:35 -0700 Subject: [PATCH 1/2] Update models for opensourceai --- pgml-sdks/pgml/Cargo.lock | 2 +- pgml-sdks/pgml/src/open_source_ai.rs | 123 +++++---------------------- 2 files changed, 20 insertions(+), 105 deletions(-) diff --git a/pgml-sdks/pgml/Cargo.lock b/pgml-sdks/pgml/Cargo.lock index 784b528a7..8de1d3967 100644 --- a/pgml-sdks/pgml/Cargo.lock +++ b/pgml-sdks/pgml/Cargo.lock @@ -1590,7 +1590,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pgml" -version = "1.0.4" +version = "1.1.0" dependencies = [ "anyhow", "async-trait", diff --git a/pgml-sdks/pgml/src/open_source_ai.rs b/pgml-sdks/pgml/src/open_source_ai.rs index f582ee80d..1ed511c73 100644 --- a/pgml-sdks/pgml/src/open_source_ai.rs +++ b/pgml-sdks/pgml/src/open_source_ai.rs @@ -35,112 +35,40 @@ fn try_model_nice_name_to_model_name_and_parameters( "meta-llama/Meta-Llama-3-8B-Instruct" => Some(( "meta-llama/Meta-Llama-3-8B-Instruct", serde_json::json!({ - "task": "conversationa", + "task": "conversational", "model": "meta-llama/Meta-Llama-3-8B-Instruct" }) .into(), )), - - "mistralai/Mistral-7B-Instruct-v0.1" => Some(( - "mistralai/Mistral-7B-Instruct-v0.1", - serde_json::json!({ - "task": "conversational", - "model": "mistralai/Mistral-7B-Instruct-v0.1", - "device_map": "auto", - "torch_dtype": "bfloat16" - }) - .into(), - )), - - "TheBloke/Llama-2-7B-Chat-GPTQ" => Some(( - "TheBloke/Llama-2-7B-Chat-GPTQ", - serde_json::json!({ - "task": "conversational", - "model": "TheBloke/Llama-2-7B-Chat-GPTQ", - "device_map": "auto", - "revision": "main" - }) - .into(), - )), - - "teknium/OpenHermes-2.5-Mistral-7B" => Some(( - "teknium/OpenHermes-2.5-Mistral-7B", - serde_json::json!({ - "task": "conversational", - "model": "teknium/OpenHermes-2.5-Mistral-7B", - "device_map": "auto", - "torch_dtype": "bfloat16" - }) - .into(), - )), - - "Open-Orca/Mistral-7B-OpenOrca" => Some(( - "Open-Orca/Mistral-7B-OpenOrca", - serde_json::json!({ - "task": "conversational", - "model": "Open-Orca/Mistral-7B-OpenOrca", - "device_map": "auto", - "torch_dtype": "bfloat16" - }) - .into(), - )), - - "Undi95/Toppy-M-7B" => Some(( - "Undi95/Toppy-M-7B", - serde_json::json!({ - "model": "Undi95/Toppy-M-7B", - "device_map": "auto", - "torch_dtype": "bfloat16" - }) - .into(), - )), - - "Undi95/ReMM-SLERP-L2-13B" => Some(( - "Undi95/ReMM-SLERP-L2-13B", + "meta-llama/Meta-Llama-3-70B-Instruct" => Some(( + "meta-llama/Meta-Llama-3-70B-Instruct", serde_json::json!({ - "model": "Undi95/ReMM-SLERP-L2-13B", - "device_map": "auto", - "torch_dtype": "bfloat16" + "task": "conversational", + "model": "meta-llama/Meta-Llama-3-70B-Instruct" }) .into(), )), - - "Gryphe/MythoMax-L2-13b" => Some(( - "Gryphe/MythoMax-L2-13b", + "microsoft/Phi-3-mini-128k-instruct" => Some(( + "microsoft/Phi-3-mini-128k-instruct", serde_json::json!({ - "model": "Gryphe/MythoMax-L2-13b", - "device_map": "auto", - "torch_dtype": "bfloat16" + "task": "conversational", + "model": "microsoft/Phi-3-mini-128k-instruct" }) .into(), )), - - "PygmalionAI/mythalion-13b" => Some(( - "PygmalionAI/mythalion-13b", + "mistralai/Mixtral-8x7B-Instruct-v0.1" => Some(( + "mistralai/Mixtral-8x7B-Instruct-v0.1", serde_json::json!({ - "model": "PygmalionAI/mythalion-13b", - "device_map": "auto", - "torch_dtype": "bfloat16" + "task": "conversational", + "model": "mistralai/Mixtral-8x7B-Instruct-v0.1" }) .into(), )), - - "deepseek-ai/deepseek-llm-7b-chat" => Some(( - "deepseek-ai/deepseek-llm-7b-chat", + "mistralai/Mistral-7B-Instruct-v0.2" => Some(( + "mistralai/Mistral-7B-Instruct-v0.2", serde_json::json!({ - "model": "deepseek-ai/deepseek-llm-7b-chat", - "device_map": "auto", - "torch_dtype": "bfloat16" - }) - .into(), - )), - - "Phind/Phind-CodeLlama-34B-v2" => Some(( - "Phind/Phind-CodeLlama-34B-v2", - serde_json::json!({ - "model": "Phind/Phind-CodeLlama-34B-v2", - "device_map": "auto", - "torch_dtype": "bfloat16" + "task": "conversational", + "model": "mistralai/Mistral-7B-Instruct-v0.2" }) .into(), )), @@ -149,15 +77,6 @@ fn try_model_nice_name_to_model_name_and_parameters( } } -fn try_get_model_chat_template(model_name: &str) -> Option<&'static str> { - match model_name { - // Any Alpaca instruct tuned model - "Undi95/Toppy-M-7B" | "Undi95/ReMM-SLERP-L2-13B" | "Gryphe/MythoMax-L2-13b" | "Phind/Phind-CodeLlama-34B-v2" => Some("{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ '### Instruction:\n' + message['content'] + '\n'}}\n{% elif message['role'] == 'system' %}\n{{ message['content'] + '\n'}}\n{% elif message['role'] == 'model' %}\n{{ '### Response:>\n' + message['content'] + eos_token + '\n'}}\n{% endif %}\n{% if loop.last and add_generation_prompt %}\n{{ '### Response:' }}\n{% endif %}\n{% endfor %}"), - "PygmalionAI/mythalion-13b" => Some("{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ '<|user|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'system' %}\n{{ '<|system|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'model' %}\n{{ '<|model|>\n' + message['content'] + eos_token }}\n{% endif %}\n{% if loop.last and add_generation_prompt %}\n{{ '<|model|>' }}\n{% endif %}\n{% endfor %}"), - _ => None - } -} - struct AsyncToSyncJsonIterator(std::pin::Pin> + Send>>); impl Iterator for AsyncToSyncJsonIterator { @@ -265,9 +184,7 @@ mistralai/Mistral-7B-v0.1 // TODO: Add n let mut args = serde_json::json!({ "max_tokens": max_tokens, "temperature": temperature }); - if let Some(t) = chat_template - .or_else(|| try_get_model_chat_template(&model_name).map(|s| s.to_string())) - { + if let Some(t) = chat_template { args.as_object_mut().unwrap().insert( "chat_template".to_string(), serde_json::to_value(t).unwrap(), @@ -355,9 +272,7 @@ mistralai/Mistral-7B-v0.1 // TODO: Add n let mut args = serde_json::json!({ "max_tokens": max_tokens, "temperature": temperature }); - if let Some(t) = chat_template - .or_else(|| try_get_model_chat_template(&model_name).map(|s| s.to_string())) - { + if let Some(t) = chat_template { args.as_object_mut().unwrap().insert( "chat_template".to_string(), serde_json::to_value(t).unwrap(), From ab44a2afbe54df90b9d2a59ca1a9975a0940421e Mon Sep 17 00:00:00 2001 From: SilasMarvin <19626586+SilasMarvin@users.noreply.github.com> Date: Tue, 25 Jun 2024 10:33:04 -0700 Subject: [PATCH 2/2] Update versions --- pgml-sdks/pgml/Cargo.lock | 2 +- pgml-sdks/pgml/Cargo.toml | 2 +- pgml-sdks/pgml/javascript/package.json | 2 +- pgml-sdks/pgml/pyproject.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pgml-sdks/pgml/Cargo.lock b/pgml-sdks/pgml/Cargo.lock index 8de1d3967..c1999cca7 100644 --- a/pgml-sdks/pgml/Cargo.lock +++ b/pgml-sdks/pgml/Cargo.lock @@ -1590,7 +1590,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pgml" -version = "1.1.0" +version = "1.1.1" dependencies = [ "anyhow", "async-trait", diff --git a/pgml-sdks/pgml/Cargo.toml b/pgml-sdks/pgml/Cargo.toml index 0a190eaf4..179c2d898 100644 --- a/pgml-sdks/pgml/Cargo.toml +++ b/pgml-sdks/pgml/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pgml" -version = "1.1.0" +version = "1.1.1" edition = "2021" authors = ["PosgresML "] homepage = "https://postgresml.org/" diff --git a/pgml-sdks/pgml/javascript/package.json b/pgml-sdks/pgml/javascript/package.json index 148b9b910..9700714bb 100644 --- a/pgml-sdks/pgml/javascript/package.json +++ b/pgml-sdks/pgml/javascript/package.json @@ -1,6 +1,6 @@ { "name": "pgml", - "version": "1.1.0", + "version": "1.1.1", "description": "Open Source Alternative for Building End-to-End Vector Search Applications without OpenAI & Pinecone", "keywords": [ "postgres", diff --git a/pgml-sdks/pgml/pyproject.toml b/pgml-sdks/pgml/pyproject.toml index 8303315fa..ed1036424 100644 --- a/pgml-sdks/pgml/pyproject.toml +++ b/pgml-sdks/pgml/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "maturin" [project] name = "pgml" requires-python = ">=3.7" -version = "1.1.0" +version = "1.1.1" description = "Python SDK is designed to facilitate the development of scalable vector search applications on PostgreSQL databases." authors = [ {name = "PostgresML", email = "team@postgresml.org"}, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy