@@ -34,8 +34,6 @@ pub fn get_model_from(task: &Value) -> Result<String> {
3434}
3535
3636pub fn embed ( transformer : & str , inputs : Vec < & str > , kwargs : & serde_json:: Value ) -> Result < Vec < Vec < f32 > > > {
37- crate :: bindings:: python:: activate ( ) ?;
38-
3937 let kwargs = serde_json:: to_string ( kwargs) ?;
4038 Python :: with_gil ( |py| -> Result < Vec < Vec < f32 > > > {
4139 let embed: Py < PyAny > = get_module ! ( PY_MODULE ) . getattr ( py, "embed" ) . format_traceback ( py) ?;
@@ -58,8 +56,6 @@ pub fn embed(transformer: &str, inputs: Vec<&str>, kwargs: &serde_json::Value) -
5856}
5957
6058pub fn tune ( task : & Task , dataset : TextDataset , hyperparams : & JsonB , path : & Path ) -> Result < HashMap < String , f64 > > {
61- crate :: bindings:: python:: activate ( ) ?;
62-
6359 let task = task. to_string ( ) ;
6460 let hyperparams = serde_json:: to_string ( & hyperparams. 0 ) ?;
6561
@@ -86,8 +82,6 @@ pub fn tune(task: &Task, dataset: TextDataset, hyperparams: &JsonB, path: &Path)
8682}
8783
8884pub fn generate ( model_id : i64 , inputs : Vec < & str > , config : JsonB ) -> Result < Vec < String > > {
89- crate :: bindings:: python:: activate ( ) ?;
90-
9185 Python :: with_gil ( |py| -> Result < Vec < String > > {
9286 let generate = get_module ! ( PY_MODULE ) . getattr ( py, "generate" ) . format_traceback ( py) ?;
9387 let config = serde_json:: to_string ( & config. 0 ) ?;
@@ -162,8 +156,6 @@ pub fn load_dataset(
162156 limit : Option < usize > ,
163157 kwargs : & serde_json:: Value ,
164158) -> Result < usize > {
165- crate :: bindings:: python:: activate ( ) ?;
166-
167159 let kwargs = serde_json:: to_string ( kwargs) ?;
168160
169161 let dataset = Python :: with_gil ( |py| -> Result < String > {
@@ -313,8 +305,6 @@ pub fn load_dataset(
313305}
314306
315307pub fn clear_gpu_cache ( memory_usage : Option < f32 > ) -> Result < bool > {
316- crate :: bindings:: python:: activate ( ) . unwrap ( ) ;
317-
318308 Python :: with_gil ( |py| -> Result < bool > {
319309 let clear_gpu_cache: Py < PyAny > = get_module ! ( PY_MODULE )
320310 . getattr ( py, "clear_gpu_cache" )
0 commit comments