Skip to content

Commit 0c0f39e

Browse files
authored
cargo fmt (#571)
1 parent eed7276 commit 0c0f39e

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

pgml-extension/src/api.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,10 @@ fn predict_i64(project_name: &str, features: Vec<i64>) -> f32 {
440440

441441
#[pg_extern(strict, name = "predict")]
442442
fn predict_bool(project_name: &str, features: Vec<bool>) -> f32 {
443-
predict_f32(project_name, features.iter().map(|&i| i as u8 as f32).collect())
443+
predict_f32(
444+
project_name,
445+
features.iter().map(|&i| i as u8 as f32).collect(),
446+
)
444447
}
445448

446449
#[pg_extern(strict, name = "predict_proba")]
@@ -579,16 +582,8 @@ pub fn transform_string(
579582

580583
#[cfg(feature = "python")]
581584
#[pg_extern(name = "generate")]
582-
fn generate(
583-
project_name: &str,
584-
inputs: &str,
585-
config: default!(JsonB, "'{}'"),
586-
) -> String {
587-
generate_batch(
588-
project_name,
589-
Vec::from([inputs]),
590-
config,
591-
)
585+
fn generate(project_name: &str, inputs: &str, config: default!(JsonB, "'{}'")) -> String {
586+
generate_batch(project_name, Vec::from([inputs]), config)
592587
.first()
593588
.unwrap()
594589
.to_string()

pgml-extension/src/bindings/transformers.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,7 @@ pub fn tune(
8383
metrics
8484
}
8585

86-
pub fn generate(
87-
model_id: i64,
88-
inputs: Vec<&str>,
89-
config: JsonB,
90-
) -> Vec<String> {
86+
pub fn generate(model_id: i64, inputs: Vec<&str>, config: JsonB) -> Vec<String> {
9187
Python::with_gil(|py| -> Vec<String> {
9288
let generate = PY_MODULE.getattr(py, "generate").unwrap();
9389
let config = serde_json::to_string(&config.0).unwrap();

0 commit comments

Comments
 (0)
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