paths_internal.py 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. """this module defines internal paths used by program and is safe to import before dependencies are installed in launch.py"""
  2. import argparse
  3. import os
  4. import sys
  5. import shlex
  6. commandline_args = os.environ.get('COMMANDLINE_ARGS', "")
  7. sys.argv += shlex.split(commandline_args)
  8. modules_path = os.path.dirname(os.path.realpath(__file__))
  9. script_path = os.path.dirname(modules_path)
  10. sd_configs_path = os.path.join(script_path, "configs")
  11. sd_default_config = os.path.join(sd_configs_path, "v1-inference.yaml")
  12. sd_model_file = os.path.join(script_path, 'model.ckpt')
  13. default_sd_model_file = sd_model_file
  14. # Parse the --data-dir flag first so we can use it as a base for our other argument default values
  15. parser_pre = argparse.ArgumentParser(add_help=False)
  16. parser_pre.add_argument("--data-dir", type=str, default=os.path.dirname(modules_path), help="base path where all user data is stored", )
  17. cmd_opts_pre = parser_pre.parse_known_args()[0]
  18. data_path = cmd_opts_pre.data_dir
  19. models_path = os.path.join(data_path, "models")
  20. extensions_dir = os.path.join(data_path, "extensions")
  21. extensions_builtin_dir = os.path.join(script_path, "extensions-builtin")
  22. config_states_dir = os.path.join(script_path, "config_states")
  23. roboto_ttf_file = os.path.join(modules_path, 'Roboto-Regular.ttf')