Skip to content
Merged
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
2 changes: 1 addition & 1 deletion pgml-extension/Cargo.lock

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

2 changes: 1 addition & 1 deletion pgml-extension/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgml"
version = "2.7.7"
version = "2.7.8"
edition = "2021"

[lib]
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion pgml-extension/sql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ SELECT pgml.auto_updated_at('pgml.snapshots');
CREATE TABLE IF NOT EXISTS pgml.models(
id BIGSERIAL PRIMARY KEY,
project_id BIGINT NOT NULL,
snapshot_id BIGINT NOT NULL,
snapshot_id BIGINT,
num_features INT NOT NULL,
algorithm TEXT NOT NULL,
runtime pgml.runtime DEFAULT 'python'::pgml.runtime,
Expand Down
4 changes: 4 additions & 0 deletions pgml-extension/src/orm/file.rs
Original file line number Diff line number Diff 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 deletions pgml-extension/src/orm/model.rs
Original file line number Diff line number Diff 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 Down Expand 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 deletions pgml-extension/src/orm/runtime.rs
Original file line number Diff line number Diff 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 deletions pgml-extension/src/orm/task.rs
Original file line number Diff line number Diff 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 Down Expand 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(),
}
}
}
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