Skip to content

Commit

Permalink
updating the error handling (#41)
Browse files Browse the repository at this point in the history
* adding glue module to enable error handling (#27)

* added batching runner (#28)

* Kings college london integration (#30)

* adding build using binary downloads (#8)

* adding build using binary downloads

* sorting out the build.rs

* updating build.rs for surrealml package

* prepping version for release

* now has target tracking (#10)

* adding check in build.rs for docs.rs

* removing build.rs for main surrealml to ensure that libraries using the core do not need to do anything in their build.rs

* adding machine learning pipelines for bioengineering projects at Kings College London

* Remove integrated_training_runner/run_env/ from tracking

* adding machine learning pipelines for bioengineering projects at Kings College London

* Update FFmpeg data access module and README (#29)

* adding run_env to the gitignore

---------

Co-authored-by: Yang Li <[email protected]>

* bumping the version

* updating the README and module

* updating the surrealml-core deployment workflow

* updating the surrealml-core deployment workflow

* updating cargo

* Error modules (#36)

* Develop (#35)

* adding glue module to enable error handling (#27)

* added batching runner (#28)

* Kings college london integration (#30)

* adding build using binary downloads (#8)

* adding build using binary downloads

* sorting out the build.rs

* updating build.rs for surrealml package

* prepping version for release

* now has target tracking (#10)

* adding check in build.rs for docs.rs

* removing build.rs for main surrealml to ensure that libraries using the core do not need to do anything in their build.rs

* adding machine learning pipelines for bioengineering projects at Kings College London

* Remove integrated_training_runner/run_env/ from tracking

* adding machine learning pipelines for bioengineering projects at Kings College London

* Update FFmpeg data access module and README (#29)

* adding run_env to the gitignore

---------

Co-authored-by: Yang Li <[email protected]>

* bumping the version

* updating the README and module

* updating the surrealml-core deployment workflow

* updating the surrealml-core deployment workflow

* updating cargo

---------

Co-authored-by: Sam Hillman <[email protected]>
Co-authored-by: Yang Li <[email protected]>

* merging error modules into the core

* merging error modules into the core

* merging error modules into the core

---------

Co-authored-by: Sam Hillman <[email protected]>
Co-authored-by: Yang Li <[email protected]>

* Index overflow (#40)

* adding buffer out of index check

* adding buffer out of index check

---------

Co-authored-by: Sam Hillman <[email protected]>
Co-authored-by: Yang Li <[email protected]>
  • Loading branch information
3 people authored Mar 25, 2024
1 parent 888e0f1 commit bc6bc68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "surrealml-core"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
build = "./build.rs"
description = "The core machine learning library for SurrealML that enables SurrealDB to store and load ML models"
Expand Down
12 changes: 11 additions & 1 deletion modules/core/src/storage/surml_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,24 @@ impl SurMlFile {
buffer.copy_from_slice(&bytes[0..4]);
let integer_value = u32::from_be_bytes(buffer);

// check to see if there is enough bytes to read
if bytes.len() < (4 + integer_value as usize) {
return Err(
SurrealError::new(
"Not enough bytes to read for header, maybe the file format is not correct".to_string(),
SurrealErrorStatus::BadRequest
)
);
}

// Read the next integer_value bytes for the header
header_bytes.extend_from_slice(&bytes[4..(4 + integer_value as usize)]);

// Read the remaining bytes for the model
model_bytes.extend_from_slice(&bytes[(4 + integer_value as usize)..]);

// construct the header and C model from the bytes
let header = Header::from_bytes(header_bytes).unwrap();
let header = Header::from_bytes(header_bytes)?;
let model = model_bytes;
Ok(Self {
header,
Expand Down

0 comments on commit bc6bc68

Please sign in to comment.