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

OpenAI runtime#944

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
SilasMarvin merged 4 commits intomasterfromlevkk-openai-enum
Aug 23, 2023
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-extension/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-extension/Cargo.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
[package]
name ="pgml"
version ="2.7.7"
version ="2.7.8"
edition ="2021"

[lib]
Expand Down
View file
Open in desktop
Empty file.
2 changes: 1 addition & 1 deletionpgml-extension/sql/schema.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,7 +82,7 @@ SELECT pgml.auto_updated_at('pgml.snapshots');
CREATETABLEIF NOT EXISTSpgml.models(
idBIGSERIALPRIMARY KEY,
project_idBIGINTNOT NULL,
snapshot_idBIGINTNOT NULL,
snapshot_idBIGINT,
num_featuresINTNOT NULL,
algorithmTEXTNOT NULL,
runtimepgml.runtime DEFAULT'python'::pgml.runtime,
Expand Down
4 changes: 4 additions & 0 deletionspgml-extension/src/orm/file.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -115,6 +115,10 @@ pub fn find_deployed_estimator_by_model_id(model_id: i64) -> Result<Arc<Box<dyn
Runtime::python =>{
anyhow::bail!("Python runtime not supported, recompile with `--features python`")
}

Runtime::openai =>{
error!("OpenAI runtime is not supported for training or inference");
}
};

// Cache the estimator in process memory.
Expand Down
8 changes: 8 additions & 0 deletionspgml-extension/src/orm/model.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -306,6 +306,10 @@ impl Model {
.unwrap();

let bindings: Box<dyn Bindings> = match runtime {
Runtime::openai => {
error!("OpenAI runtime is not supported for training or inference");
}

Runtime::rust => {
match algorithm {
Algorithm::xgboost => {
Expand DownExpand Up@@ -396,6 +400,10 @@ impl Model {

fn get_fit_function(&self) -> crate::bindings::Fit {
match self.runtime {
Runtime::openai => {
error!("OpenAI runtime is not supported for training or inference");
}

Runtime::rust => match self.project.task {
Task::regression => match self.algorithm {
Algorithm::xgboost => xgboost::fit_regression,
Expand Down
3 changes: 3 additions & 0 deletionspgml-extension/src/orm/runtime.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,7 @@ use serde::Deserialize;
pub enum Runtime {
python,
rust,
openai,
}

impl std::str::FromStr for Runtime {
Expand All@@ -15,6 +16,7 @@ impl std::str::FromStr for Runtime {
match input {
"python" => Ok(Runtime::python),
"rust" => Ok(Runtime::rust),
"openai" => Ok(Runtime::openai),
_ => Err(()),
}
}
Expand All@@ -25,6 +27,7 @@ impl std::string::ToString for Runtime {
match *self {
Runtime::python => "python".to_string(),
Runtime::rust => "rust".to_string(),
Runtime::openai => "openai".to_string(),
}
}
}
5 changes: 5 additions & 0 deletionspgml-extension/src/orm/task.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@ pub enum Task {
text_generation,
text2text,
cluster,
embedding,
}

// unfortunately the pgrx macro expands the enum names to underscore, but huggingface uses dash
Expand All@@ -28,6 +29,7 @@ impl Task {
Task::text_generation => "text_generation".to_string(),
Task::text2text => "text2text".to_string(),
Task::cluster => "cluster".to_string(),
Task::embedding => "embedding".to_string(),
}
}

Expand All@@ -46,6 +48,7 @@ impl Task {
Task::text_generation => "perplexity",
Task::text2text => "perplexity",
Task::cluster => "silhouette",
Task::embedding => error!("No default target metric for embedding task")
}
.to_string()
}
Expand All@@ -61,6 +64,7 @@ impl Task {
Task::text_generation => false,
Task::text2text => false,
Task::cluster => true,
Task::embedding => error!("No default target metric positive for embedding task")
}
}

Expand DownExpand Up@@ -117,6 +121,7 @@ impl std::string::ToString for Task {
Task::text_generation => "text-generation".to_string(),
Task::text2text => "text2text".to_string(),
Task::cluster => "cluster".to_string(),
Task::embedding => "embedding".to_string(),
}
}
}

[8]ページ先頭

©2009-2025 Movatter.jp