Skip to content

Commit

Permalink
change configuration prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
milenkovicm committed Mar 7, 2024
1 parent 5cc5f5b commit 9ddd99c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ let sql = r#"
ctx.sql(sql).await?.show().await?;

// ctx.sql("SET torch.cuda_device = 0").await?;
ctx.sql("SET torch.device = cpu").await?.show().await?;
ctx.sql("SET torchfusion.device = cpu").await?.show().await?;

// definition of torch model to use
let sql = r#"
Expand Down
7 changes: 5 additions & 2 deletions examples/torchfusion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ async fn main() -> datafusion::error::Result<()> {

ctx.sql(sql).await?.show().await?;

// ctx.sql("SET torch.cuda_device = 0").await?;
ctx.sql("SET torch.device = cpu").await?.show().await?;
// ctx.sql("SET torchfusion.cuda_device = 0").await?;
ctx.sql("SET torchfusion.device = cpu")
.await?
.show()
.await?;

// definition of torch model to use
let sql = r#"
Expand Down
6 changes: 3 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ impl ExtensionOptions for TorchConfig {
fn entries(&self) -> Vec<datafusion::config::ConfigEntry> {
vec![
ConfigEntry {
key: "device".into(),
key: format!("{}.device", Self::PREFIX),
value: Some(format!("{:?}", self.device)),
description: "Device to run model on. Valid values 'cpu', 'cuda', 'mps', 'vulkan'. Default: 'cpu' ",
},
ConfigEntry {
key: "cuda_device".into(),
key: format!("{}.cuda_device", Self::PREFIX),
value: Some(format!("{}", self.cuda_device)),
description: "Cuda device to use. Valid value positive integer. Default: 0",
},
Expand All @@ -83,5 +83,5 @@ impl TorchConfig {
}

impl ConfigExtension for TorchConfig {
const PREFIX: &'static str = "torch";
const PREFIX: &'static str = "torchfusion";
}

0 comments on commit 9ddd99c

Please sign in to comment.