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

fix: cd into src instead of bento parent #4805

Merged
merged 1 commit into from
Jun 14, 2024
Merged
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
11 changes: 6 additions & 5 deletions src/_bentoml_impl/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,21 @@ def import_service(
extra_python_path = None

# patch model store if needed
if (bento_parent_dir := bento_path.parent).joinpath(
BENTO_YAML_FILENAME
).exists() and bento_parent_dir.joinpath("models").exists():
if (
bento_path.with_name(BENTO_YAML_FILENAME).exists()
and bento_path.with_name("models").exists()
):
from bentoml._internal.models import ModelStore

original_path = os.getcwd()
original_model_store = BentoMLContainer.model_store.get()
# cwd into this for relative path to work
os.chdir(bento_parent_dir.absolute())
os.chdir(bento_path.absolute())

# check in bento source

BentoMLContainer.model_store.set(
ModelStore((bento_parent_dir.joinpath("models").absolute()))
ModelStore((bento_path.with_name("models").absolute()))
)
else:
original_path = None
Expand Down
Loading