GCP AI Platform Job can't import local module

256 views Asked by At

When running a job for GCP's AI Platform I am getting an error when importing a local module. Despite an __init__.py being in the module dir.

From the job

The replica master 0 exited with a non-zero status of 1. 
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/.local/lib/python3.7/site-packages/SemBERT/run_classifier.py", line 19, in <module>
    from tag_model.modeling import TagConfig
ModuleNotFoundError: No module named 'tag_model'

Despite the fact that if I package locally, then unzip, I can import the module.

Struct of dir I'm creating the job from

├── SemBERT
│   ├── README.md
│   ├── SemBERT.png
│   ├── __init__.py
│   ├── __pycache__
│   │   └── __init__.cpython-37.pyc
│   ├── data_process
│   │   ├── __init__.py
│   │   ├── datasets.py
│   │   └── util.py
│   ├── glue_data
│   │   └── MNLI
│   │       ├── dev_matched.tsv_tag_label
│   │       ├── test_matched.tsv_tag_label
│   │       └── train.tsv_tag_label
│   ├── pytorch_pretrained_bert
│   │   ├── __init__.py
│   │   ├── __main__.py
│   │   ├── file_utils.py
│   │   ├── modeling.py
│   │   ├── optimization.py
│   │   └── tokenization.py
│   ├── run_classifier.py
│   ├── run_scorer.py
│   ├── run_snli_predict.py
│   └── tag_model
│       ├── __init__.py
│       ├── __pycache__
│       │   ├── __init__.cpython-37.pyc
│       │   └── modeling.cpython-37.pyc
│       ├── modeling.py
│       ├── tag_tokenization.py
│       ├── tagger_offline.py
│       └── tagging.py
├── setup.py
└── training.ipynb

Where --package-path is set to SemBERT.

I have packaged locally and have tested the import.

Source code can be found here

0

There are 0 answers