On trying to deploy a Model as a Container, endpoint gets created, however, scoring script fails with an error:
ImportError: attempted relative import with no known parent package
This is because i'm referencing another module (packaged in the docker image using source_directory) with a relative path from scoring file.
Can you help me in resolving this error?
Files\modules structure (a simplified version):
project
->src
-> scoring.py
-> module1.py
-> common
-> module2.py, etc
-> init.py
-> init.py
-> configs
-> conda_env.yml
In scoring.py,
from .module1.py import SomeClass
..
..
In module1.py,
from .common.module2.py importSC2
...
..
And below is how an Inference config is initialized:
inference_config = InferenceConfig(source_directory="./",
runtime= "python",
entry_script="src/scoring.py",
conda_file="configs/conda_env.yml"
)
I could not pass entry_script as "src.scoring" as this fails the Validation and relative path to scoring file is expected