Skip to content

Commit

Permalink
Merge pull request #2 from InternLM/optimize_main
Browse files Browse the repository at this point in the history
improvement(huixiangdou/main.py): auto create workdir if not exists
  • Loading branch information
tpoisonooo authored Jan 15, 2024
2 parents 22c5451 + 24d6ccb commit ab55b15
Show file tree
Hide file tree
Showing 14 changed files with 11 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ config-template.ini
logs/
logs/work.txt
server.log
service/__pycache__/
frontend/__pycache__/
**/__pycache__
pk/
badcase.txt
config.bak
Expand Down
Binary file removed huixiangdou/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file removed huixiangdou/__pycache__/main.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file removed huixiangdou/frontend/__pycache__/lark.cpython-39.pyc
Binary file not shown.
13 changes: 10 additions & 3 deletions huixiangdou/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ def parse_args():
parser.add_argument('--standalone',
action='store_true',
default=False,
help='Atuo deploy required Hybrid LLM Service.')
help='Auto deploy required Hybrid LLM Service.')
args = parser.parse_args()
return args


def check_env():
def check_env(args):
"""Check or create config.ini and logs dir."""
if not os.path.exists('logs'):
os.makedirs('logs')
Expand All @@ -51,12 +51,19 @@ def check_env():
f.write(response.content)
except Exception as e:
logger.error(f'Failed to download file due to {e}')
raise e

if not os.path.exists(args.work_dir):
logger.warning(
f'args.work_dir dir not exist, auto create {args.work_dir}.')
os.makedirs(args.work_dir)


def run():
"""Automatically download config, start llm server and run examples."""
check_env()
args = parse_args()
check_env(args)

if args.standalone:
# hybrid llm serve
server_ready = Value('i', 0)
Expand Down
Binary file removed huixiangdou/service/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit ab55b15

Please sign in to comment.