From 2eb029a7b09ae1ce92dc5989408e59df2bbb24e7 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Mon, 2 Aug 2021 00:29:09 -0700 Subject: [PATCH] Create script to install semantic-search as a program --- install.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 install.py diff --git a/install.py b/install.py new file mode 100644 index 00000000..592f4379 --- /dev/null +++ b/install.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +import pathlib +import argparse + +if __name__ == '__main__': + # Setup Argument Parser + parser = argparse.ArgumentParser(description="Setup the semantic search program") + parser.add_argument('--script-dir', '-s', default="./", type=pathlib.Path, help="The project directory. Default: Current Directory") + parser.add_argument('--install-path', '-i', default="/usr/bin/semantic-search", type=pathlib.Path, help="The directory to install the script. Default: ./embeddings.pt") + parser.add_argument('--model-dir', '-m', default="./", type=pathlib.Path, help="The directory to store the model in. Default: Current Directory") + args = parser.parse_args() + + run_script_content = f'''#!/bin/bash + +# Arrange +eval "$(conda shell.bash hook)" +conda activate samvayati +cd {args.script_dir.expanduser().absolute()} + +# Act +python3 asymmetric.py -j {args.model_dir.expanduser().absolute()}/notes.jsonl.gz -e {args.model_dir.expanduser().absolute()}/notes_embeddings.pt -n 5 --interactive +''' + + with args.install_path.open(mode='w') as run_script: + run_script.write(run_script_content)