-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove model files, download them instead. Switch from resnet18 to sq…
…ueezenet1.1
- Loading branch information
1 parent
e1afdbe
commit 39f9271
Showing
5 changed files
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,4 +75,4 @@ pytorch = ["dep:tch"] | |
|
||
[[test]] | ||
name = "test-programs" | ||
harness = false | ||
harness = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-44.7 MB
crates/wasi-nn/examples/classification-example-pytorch/fixture/model.pt
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
use super::{artifacts_dir, DOWNLOAD_LOCK}; | ||
use anyhow::Result; | ||
use super::{artifacts_dir, download, DOWNLOAD_LOCK}; | ||
use anyhow::{bail, Context, Result}; | ||
use std::{env, fs}; | ||
|
||
/// Return `Ok` if we find the cached MobileNet test artifacts; this will | ||
/// download the artifacts if necessary. | ||
pub fn are_artifacts_available() -> Result<()> { | ||
let _exclusively_retrieve_artifacts = DOWNLOAD_LOCK.lock().unwrap(); | ||
const PYTORCH_BASE_URL: &str = | ||
"https://github.com/rahulchaphalkar/libtorch-models/releases/download/v0.1/squeezenet1_1.pt"; | ||
let artifacts_dir = artifacts_dir(); | ||
if !artifacts_dir.is_dir() { | ||
fs::create_dir(&artifacts_dir)?; | ||
} | ||
|
||
// Copy preprocessed image tensor from source tree to artifact directory. | ||
let local_path = artifacts_dir.join("model.pt"); | ||
let remote_url = PYTORCH_BASE_URL; | ||
if !local_path.is_file() { | ||
download(&remote_url, &local_path).with_context(|| "unable to retrieve test artifact")?; | ||
} else { | ||
println!("> using cached artifact: {}", local_path.display()) | ||
} | ||
|
||
// Copy image from source tree to artifact directory. | ||
let image_path = env::current_dir()? | ||
.join("tests") | ||
.join("fixtures") | ||
.join("kitten.tensor"); | ||
let dest_path = artifacts_dir.join("kitten.tensor"); | ||
fs::copy(&image_path, &dest_path)?; | ||
|
||
// Copy Resnet18 model from source tree to artifact directory. | ||
let image_path = env::current_dir()? | ||
.join("tests") | ||
.join("fixtures") | ||
.join("resnet.pt"); | ||
let dest_path = artifacts_dir.join("model.pt"); | ||
fs::copy(&image_path, &dest_path)?; | ||
|
||
Ok(()) | ||
} |
Binary file not shown.