Source code for revive.cli

import loguru
import os
import sys
import revive

[docs] def main(): argv = sys.argv[1:] print(f"REVIVE:") print(f" Author : Polixir Technologies Co., Ltd.") print(f" Official Website : https://revive.cn/") if argv: mode = argv[0] if mode == "train": python_executable = sys.executable script_file_path = os.path.abspath(os.path.join(revive.__file__,"../../","train.py")) command = f"{python_executable} {script_file_path} {' '.join(sys.argv[1:])}" loguru.logger.info(f"Strat train -> {command}") os.system(command) elif mode == "rollout": python_executable = sys.executable script_file_path = os.path.abspath(os.path.join(revive.__file__,"../utils/rollout.py")) command = f"{python_executable} {script_file_path} {' '.join(sys.argv[1:])}" loguru.logger.info(f"Strat rollout -> {command}") os.system(command) elif mode == "version": print(f" REVIVE VERSION : {revive.__version__}") elif mode == "register": print("") if len(argv) == 1: print(f"Error: Registration requires passing an access key. For example: revive register UKODIzODU5Nz8311") sys.exit() accesskey = argv[1] print(f"Register REIVIVE by accesskey : {accesskey}") config_folder = os.path.join(os.path.expanduser('~'),".revive") with open(os.path.join(config_folder,'config.yaml'), 'w', encoding='utf-8') as f: lines = [] lines.append(f"accesskey: {accesskey}"+"\n") f.writelines(lines) else: print(""" REVIVE Help: Available Commands: train Train the model version Display REVIVE version information register [key] Register REVIVE with an access key help Display this help information Examples: revive train -df ./data ... revive register YOUR_ACCESS_KEY """)
if __name__ == '__main__': main()