[bugfix] conda path lookup (#179)

* fix conda lookup

* comments
This commit is contained in:
Xi Yan 2024-10-03 10:45:16 -07:00 committed by GitHub
parent d74501f75c
commit b9b1e8b08b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 16 deletions

View file

@ -39,7 +39,9 @@ class StackConfigure(Subcommand):
)
def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None:
import json
import os
import subprocess
from pathlib import Path
import pkg_resources
@ -65,18 +67,19 @@ class StackConfigure(Subcommand):
f"Could not find {build_config_file}. Trying conda build name instead...",
color="green",
)
if os.getenv("CONDA_PREFIX", ""):
conda_dir = (
Path(os.getenv("CONDA_PREFIX")).parent / f"llamastack-{args.config}"
)
else:
cprint(
"Cannot find CONDA_PREFIX. Trying default conda path ~/.conda/envs...",
color="green",
)
conda_dir = (
Path(os.path.expanduser("~/.conda/envs")) / f"llamastack-{args.config}"
)
conda_dir = (
Path(os.path.expanduser("~/.conda/envs")) / f"llamastack-{args.config}"
)
output = subprocess.check_output(
["bash", "-c", "conda info --json -a | jq '.envs'"]
)
conda_envs = json.loads(output.decode("utf-8"))
for x in conda_envs:
if x.endswith(f"/llamastack-{args.config}"):
conda_dir = Path(x)
break
build_config_file = Path(conda_dir) / f"{args.config}-build.yaml"

View file

@ -1,7 +1,7 @@
built_at: '2024-09-23T00:54:40.551416'
image_name: test-2
image_name: local
docker_image: null
conda_env: test-2
conda_env: local
apis_to_serve:
- shields
- agents
@ -34,12 +34,12 @@ routing_table:
inference:
- provider_type: meta-reference
config:
model: Meta-Llama3.1-8B-Instruct
model: Llama3.1-8B-Instruct
quantization: null
torch_seed: null
max_seq_len: 4096
max_batch_size: 1
routing_key: Meta-Llama3.1-8B-Instruct
routing_key: Llama3.1-8B-Instruct
safety:
- provider_type: meta-reference
config: