Skip to content

fix(modal): install open_altergo_engine into the image - #1

Merged
ebowwa merged 1 commit into
mainfrom
fix/modal-engine-install
Jul 25, 2026
Merged

ebowwa merged 1 commit into
mainfrom
fix/modal-engine-install

Conversation

@ebowwa

@ebowwa ebowwa commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Problem

The Modal image in cloud/modal/app.py installed the heavy ML stack (torch, mediapipe, opencv, pytorch-lightning, …) and copied the repo, but never installed the cloud/engine package. Both provisioned jobs shell out to training scripts that import it:

  • train_personal.py → open_altergo_engine.model_assets, .datamodule.data_module.DataModule, and via personalization → .lightning.ModelModule
  • prepare_dataset.py → .datamodule.transforms, .preparation.detectors.*

Result: modal run cloud/modal/app.py::prepare / ::train crashed immediately with ModuleNotFoundError: No module named 'open_altergo_engine'.

Fix

Install the engine from the copied source after add_local_dir. Image.pip_install only accepts package specifiers, so install from the in-image path via run_commands:

.run_commands(f"pip install {REMOTE_PROJECT / 'cloud' / 'engine'}")

Verification

Built the exact image prepare/train use and ran a smoke function inside it. After the fix:

Check Result
import open_altergo_engine ✅ ok
open_altergo_engine.datamodule.data_module.DataModule ✅ ok
open_altergo_engine.model_assets + engine CLI (-m open_altergo_engine.model_assets) ✅ ok
torch 2.6.0+cu124, torchvision/torchaudio, pytorch-lightning 2.6.5 ✅
cv2 4.10.0, mediapipe 0.10.21, sentencepiece, av, huggingface_hub ✅
numpy 1.26.4, scikit-image, Pillow, ffmpeg ✅
training/train_personal.py, training/prepare_dataset.py present ✅

(Engine wheel builds clean at 83 KB; its pyproject.toml declares no runtime deps, so the heavy stack already in the image covers everything.)

🤖 Generated with Claude Code

The Modal image installed the heavy ML stack and copied the repo, but
never installed the cloud/engine package. Both provisioned jobs shell out
to training scripts that import it:

- train_personal.py -> open_altergo_engine.model_assets,
  .datamodule.data_module.DataModule, and via personalization
  -> .lightning.ModelModule
- prepare_dataset.py -> .datamodule.transforms, .preparation.detectors.*

So prepare/train crashed immediately with
`ModuleNotFoundError: No module named 'open_altergo_engine'`.

Install the engine from the copied source after add_local_dir.
pip_install only accepts package specifiers, so install from the
in-image path via run_commands. Verified inside the built image:
open_altergo_engine, DataModule, model_assets, and the engine CLI all
import/run, alongside the full torch/mediapipe/opencv/lightning stack.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant