diff --git a/hpvm/projects/keras/frontend/approxhpvm_translator.py b/hpvm/projects/keras/frontend/approxhpvm_translator.py index 59bc0d17c0605672153a542e850d98cf9d868d77..1b041a6de475d5770268db113ecde16e0403c62a 100644 --- a/hpvm/projects/keras/frontend/approxhpvm_translator.py +++ b/hpvm/projects/keras/frontend/approxhpvm_translator.py @@ -978,7 +978,7 @@ class TensorRtTranslator: self.add_header() - dir_path = "std::string dir_prefix = std::string(MODEL_PARAMS_DIR) + std::string(\"" + weights_dir + "\"); \n" + dir_path = "std::string dir_prefix = std::string(\"" + weights_dir + "\"); \n" self.weight_str += dir_path if test_data is not None: diff --git a/hpvm/projects/keras/src/Benchmark.py b/hpvm/projects/keras/src/Benchmark.py index 0871b74959ce6e19c7fedb89bbc101429a42c41f..7b0b5447bc88d85a47a4274b5484b19f0a66acdc 100644 --- a/hpvm/projects/keras/src/Benchmark.py +++ b/hpvm/projects/keras/src/Benchmark.py @@ -97,10 +97,13 @@ class Benchmark: if len(argv) > 2: if argv[2] == "frontend": + + if argv[1] == "hpvm_reload": # If reloading HPVM weights use this as directory to load from in HPVM-C generated src + self.data_dir = self.reload_dir # Main call to ApproxHPVM-Keras Frontend working_dir = translate_to_approxhpvm(model, - self.data_dir, self.src_dir, ## "data/test_src/", + self.data_dir, self.src_dir, X_test, y_test, X_tuner, y_tuner, self.batch_size, # FIXIT diff --git a/hpvm/projects/keras/src/Config.py b/hpvm/projects/keras/src/Config.py index 2edc5c1add5542edabdd052097ccb4b45d608472..99e696d632c50db4ae8098a2f4836ca994b672aa 100644 --- a/hpvm/projects/keras/src/Config.py +++ b/hpvm/projects/keras/src/Config.py @@ -1,3 +1,13 @@ +import pathlib + + # Path Relative to Model Params Directory -MODEL_PARAMS_DIR = "../../../hpvm/test/dnn_benchmarks/model_params/" +abs_path = pathlib.Path(__file__).parent.absolute() +MODEL_PARAMS_DIR = str(abs_path) + "/../../../../hpvm/test/dnn_benchmarks/model_params/" + + +if __name__ == "__main__": + + abs_path = pathlib.Path(__file__).parent.absolute() + print (abs_path) diff --git a/hpvm/projects/keras/src/alexnet.py b/hpvm/projects/keras/src/alexnet.py index 9b4d9dfdcab516c1979c354b0fc803396feb3401..1d8778727b90b2e81f362cd2a75d641683a4d5b4 100644 --- a/hpvm/projects/keras/src/alexnet.py +++ b/hpvm/projects/keras/src/alexnet.py @@ -142,7 +142,8 @@ if __name__ == '__main__': ### Parameters specific to each benchmark reload_dir = MODEL_PARAMS_DIR + '/alexnet_cifar10/' keras_model_file = MODEL_PARAMS_DIR + '/alexnet_cifar10/weights.h5' - data_dir = '/alexnet_cifar10/' + #data_dir = '/alexnet_cifar10/' + data_dir = '' src_dir = 'data/alexnet_cifar10_src/' num_classes = 10 batch_size = 500