Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement(huixiangdou/main.py): auto create workdir if not exists #2

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading