Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SDK - patch opensourceai for latest models#1541

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall 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
2 changes: 1 addition & 1 deletionpgml-sdks/pgml/Cargo.lock
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletionpgml-sdks/pgml/Cargo.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
[package]
name = "pgml"
version = "1.1.0"
version = "1.1.1"
edition = "2021"
authors = ["PosgresML <team@postgresml.org>"]
homepage = "https://postgresml.org/"
Expand Down
2 changes: 1 addition & 1 deletionpgml-sdks/pgml/javascript/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletionpgml-sdks/pgml/pyproject.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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"},
Expand Down
123 changes: 19 additions & 104 deletionspgml-sdks/pgml/src/open_source_ai.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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(),
)),
Expand All@@ -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<Box<dyn Stream<Item = anyhow::Result<Json>> + Send>>);

impl Iterator for AsyncToSyncJsonIterator {
Expand DownExpand Up@@ -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(),
Expand DownExpand Up@@ -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(),
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp