Skip to content
Open
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
18 changes: 11 additions & 7 deletions src/deimkit/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import pprint

import pkg_resources
from importlib import resources as _resources

from .engine.core import BaseConfig, YAMLConfig

Expand Down Expand Up @@ -54,12 +54,16 @@ def from_model_name(cls, model_name, **kwargs):
# Try to find the config file in several possible locations
possible_paths = [
# Option 1: Look in the package's installed configs directory
pkg_resources.resource_filename(
"deimkit", f"configs/{model_name}_coco.yml"
),
pkg_resources.resource_filename(
"deimkit", f"configs/deim_dfine/{model_name}_coco.yml"
),
os.fspath(
_resources.files("deimkit").joinpath(
f"configs/{model_name}_coco.yml"
)
),
os.fspath(
_resources.files("deimkit").joinpath(
f"configs/deim_dfine/{model_name}_coco.yml"
)
),
# Option 2: Look relative to the current working directory
# os.path.join(os.getcwd(), f'configs/{model_name}_coco.yml'),
# os.path.join(os.getcwd(), f'configs/deim_dfine/{model_name}_coco.yml'),
Expand Down