-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds node truncate, leakyRelu, ConvTranspose2d and bug fixes (#188)
* added transpose for 4D,5D tensors with perm * leakyrelu added in ct_sytorch and OnnxBridge * leaky relu added to LLAMA and ct * Adds Cleartext float via sytorch (#186) (#187) from master * float added from kanav-gpt in sytorch * cleartext_fp added in Onnxbridge * i64->T in tensor.h * debug statement * typecast corrected in module.h * removing debug statement * added testing for sytorch float ct * rename tests * type_cast modified and leakyrelu added to float * convTranspose2d added in cleartext * added custom test script using pytest * adding convTranspose2d-LLAMA correctness not tested * bug fix size=1 input_prng.cpp * sytorch conv3d bug fix- dim d != 1 * addition in test file * printing bug resolved
- Loading branch information
1 parent
f6bee92
commit fc2f88d
Showing
25 changed files
with
987 additions
and
68 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import pytest | ||
import os | ||
from utils import ( | ||
run_onnx, | ||
compile_model, | ||
run_backend, | ||
compare_output, | ||
) | ||
|
||
# Get the directory path where the current script is located | ||
script_directory = os.path.dirname(os.path.abspath(__file__)) | ||
ezpc_dir = os.path.join(script_directory, "..", "..") | ||
|
||
|
||
def test_custom_model(test_dir, backend, model, input_name): | ||
""" | ||
Usage: | ||
pytest path/custom_model_test.py -s --backend CLEARTEXT_LLAMA --model /home/saksham/EzPC/OnnxBridge/nnUnet/optimized_fabiansPreActUnet.onnx --input_name /home/saksham/EzPC/OnnxBridge/nnUnet/inputs/2d_input | ||
""" | ||
os.chdir(test_dir) | ||
|
||
# model is absolute path to model.onnx | ||
# input is absolute path to input1.j | ||
# download the model & data & preprocessing_file | ||
os.system(f"cp {model} model.onnx") | ||
os.system(f"cp {input_name}.inp input1.inp") | ||
os.system(f"cp {input_name}.npy input1.npy") | ||
|
||
# preprocessed input is directly copied | ||
|
||
# run the model with OnnxRuntime | ||
run_onnx("input1.npy") | ||
|
||
# compile the model with backend | ||
compile_model(backend) | ||
|
||
# run the model with backend | ||
run_backend(backend, "input1.inp") | ||
|
||
# compare the output | ||
compare_output() | ||
|
||
os.chdir("../..") |
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
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
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
Oops, something went wrong.