File size: 1,123 Bytes
0908a41 fa707a9 0908a41 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
from pathlib import Path
import shutil
from client_server_interface import FHEDev
from matchers import AVAILABLE_MATCHERS, Matcher
print("Generating deployment files for all available filters")
# This repository's directory
REPO_DIR = Path(__file__).parent
# This repository's main necessary folders
MATCHERS_PATH = REPO_DIR / "matchers"
for matcher_name in AVAILABLE_MATCHERS:
print("Matcher:", matcher_name, "\n")
# Create the filter instance
matcher = Matcher(matcher_name)
# Compile the model on a representative inputset
matcher.compile()
# Define the directory path associated to this filter's deployment files
deployment_path = MATCHERS_PATH / (matcher_name + "/deployment")
# Delete the deployment folder and its content if it already exists
if deployment_path.is_dir():
print("Delete the deployment folder and its content ...")
shutil.rmtree(deployment_path)
# Save the files needed for deployment
print(f"Saving the files at {deployment_path} ...")
fhe_dev_filter = FHEDev(matcher, deployment_path)
fhe_dev_filter.save()
print("Done !")
|