There was an error while loading. Please reload this page.
1 parent 04ab0de commit 5aef3bfCopy full SHA for 5aef3bf
src/booster.rs
@@ -18,6 +18,20 @@ impl Booster {
18
Booster { handle }
19
}
20
21
+ /// Initialize model from bytes.
22
+ pub fn from_bytes(bytes: &[u8]) -> Result<Self> {
23
+ let booster_str = CString::new(bytes).unwrap();
24
+ let mut out_num_iteration = 0;
25
+ let mut handle = std::ptr::null_mut();
26
+ lgbm_call!(lightgbm_sys::LGBM_BoosterLoadModelFromString(
27
+ booster_str.as_ptr().cast(),
28
+ &mut out_num_iteration,
29
+ &mut handle
30
+ ))?;
31
+
32
+ Ok(Booster::new(handle))
33
+ }
34
35
/// Init from model file.
36
pub fn from_file(filename: &str) -> Result<Self> {
37
let filename_str = CString::new(filename).unwrap();
0 commit comments