From 428f19fe82ab8d5777848ccaee12c72c49081b03 Mon Sep 17 00:00:00 2001 From: laurent Date: Fri, 15 Nov 2024 16:37:16 +0100 Subject: [PATCH] More unused fixes. --- candle-examples/Cargo.toml | 2 +- candle-examples/examples/reinforcement-learning/ddpg.rs | 7 +++++-- .../examples/reinforcement-learning/vec_gym_env.rs | 3 +++ candle-pyo3/Cargo.toml | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/candle-examples/Cargo.toml b/candle-examples/Cargo.toml index 0c1219d760..df85302d6d 100644 --- a/candle-examples/Cargo.toml +++ b/candle-examples/Cargo.toml @@ -27,7 +27,7 @@ intel-mkl-src = { workspace = true, optional = true } num-traits = { workspace = true } palette = { version = "0.7.6", optional = true } enterpolation = { version = "0.2.1", optional = true} -pyo3 = { version = "0.22.0", features = ["auto-initialize"], optional = true } +pyo3 = { version = "0.22.0", features = ["auto-initialize", "abi3-py311"], optional = true } rayon = { workspace = true } rubato = { version = "0.15.0", optional = true } safetensors = { workspace = true } diff --git a/candle-examples/examples/reinforcement-learning/ddpg.rs b/candle-examples/examples/reinforcement-learning/ddpg.rs index 26d648472f..389caac1a1 100644 --- a/candle-examples/examples/reinforcement-learning/ddpg.rs +++ b/candle-examples/examples/reinforcement-learning/ddpg.rs @@ -166,6 +166,7 @@ fn track( Ok(()) } +#[allow(unused)] struct Actor<'a> { varmap: VarMap, vb: VarBuilder<'a>, @@ -210,7 +211,7 @@ impl Actor<'_> { let target_network = make_network("target-actor")?; // this sets the two networks to be equal to each other using tau = 1.0 - track(&mut varmap, &vb, "target-actor", "actor", &dims, 1.0); + track(&mut varmap, &vb, "target-actor", "actor", &dims, 1.0)?; Ok(Self { varmap, @@ -243,6 +244,7 @@ impl Actor<'_> { } } +#[allow(unused)] struct Critic<'a> { varmap: VarMap, vb: VarBuilder<'a>, @@ -286,7 +288,7 @@ impl Critic<'_> { let target_network = make_network("target-critic")?; // this sets the two networks to be equal to each other using tau = 1.0 - track(&mut varmap, &vb, "target-critic", "critic", &dims, 1.0); + track(&mut varmap, &vb, "target-critic", "critic", &dims, 1.0)?; Ok(Self { varmap, @@ -321,6 +323,7 @@ impl Critic<'_> { } } +#[allow(unused)] #[allow(clippy::upper_case_acronyms)] pub struct DDPG<'a> { actor: Actor<'a>, diff --git a/candle-examples/examples/reinforcement-learning/vec_gym_env.rs b/candle-examples/examples/reinforcement-learning/vec_gym_env.rs index 65f67f74ce..a985d9e978 100644 --- a/candle-examples/examples/reinforcement-learning/vec_gym_env.rs +++ b/candle-examples/examples/reinforcement-learning/vec_gym_env.rs @@ -2,6 +2,7 @@ use candle::{DType, Device, Result, Tensor}; use pyo3::prelude::*; +#[allow(unused)] #[derive(Debug)] pub struct Step { pub obs: Tensor, @@ -9,6 +10,7 @@ pub struct Step { pub is_done: Tensor, } +#[allow(unused)] pub struct VecGymEnv { env: PyObject, action_space: usize, @@ -19,6 +21,7 @@ fn w(res: PyErr) -> candle::Error { candle::Error::wrap(res) } +#[allow(unused)] impl VecGymEnv { pub fn new(name: &str, img_dir: Option<&str>, nprocesses: usize) -> Result { Python::with_gil(|py| { diff --git a/candle-pyo3/Cargo.toml b/candle-pyo3/Cargo.toml index 2776a3f77c..d91619fbb3 100644 --- a/candle-pyo3/Cargo.toml +++ b/candle-pyo3/Cargo.toml @@ -20,7 +20,7 @@ candle-nn = { workspace = true } candle-onnx = { workspace = true, optional = true } half = { workspace = true } intel-mkl-src = { workspace = true, optional = true } -pyo3 = { version = "0.22.0", features = ["extension-module", "abi3-py38"] } +pyo3 = { version = "0.22.0", features = ["extension-module", "abi3-py311"] } [build-dependencies] pyo3-build-config = "0.22"