mirror of
https://github.com/mii443/usls.git
synced 2025-08-22 15:45:41 +00:00
Adding external data file support for ONNX models (#104)
This commit is contained in:
@ -5,7 +5,7 @@ use usls::{models::GroundingDINO, Annotator, Config, DataLoader};
|
||||
/// Example
|
||||
struct Args {
|
||||
/// dtype
|
||||
#[argh(option, default = "String::from(\"fp16\")")]
|
||||
#[argh(option, default = "String::from(\"q8\")")]
|
||||
dtype: String,
|
||||
|
||||
/// device
|
||||
|
@ -72,6 +72,19 @@ impl ORTConfig {
|
||||
let stem = try_fetch_file_stem(&self.file)?;
|
||||
self.spec = format!("{}/{}", name, stem);
|
||||
self.file = Hub::default().try_fetch(&format!("{}/{}", name, self.file))?;
|
||||
|
||||
// try fetch external data file if it exists
|
||||
match Hub::default().try_fetch(&format!("{}_data", self.file)) {
|
||||
Ok(external_data_file) => {
|
||||
log::debug!(
|
||||
"Successfully fetched external data file: {}",
|
||||
external_data_file
|
||||
);
|
||||
}
|
||||
Err(_) => {
|
||||
log::debug!("No external data file found for model {}", self.file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user