Skip to content

fix: move flash imports after maybe_unpack to fix torch import errors#63

Merged
deanq merged 1 commit intomainfrom
deanq/ae-2079-fix-wrongful-local-execution
Feb 10, 2026
Merged

fix: move flash imports after maybe_unpack to fix torch import errors#63
deanq merged 1 commit intomainfrom
deanq/ae-2079-fix-wrongful-local-execution

Conversation

@deanq
Copy link
Contributor

@deanq deanq commented Feb 10, 2026

Summary

Fixes torch import errors by reordering Flash imports to occur after maybe_unpack() call.

Problem

Torch imports were failing with "No module named 'torch'" errors during execution because runpod_flash imports were happening before /app was added to sys.path.

Solution

Move runpod_flash imports after the maybe_unpack() call to ensure /app is in the path before importing modules that may have torch imports at module level.

Changes

  • Reordered imports in src/lb_handler.py

Testing

  • Verify torch imports work correctly
  • Test load balancer handler execution
  • Confirm no import errors in worker startup

Related Issues

Fixes AE-2079

Move runpod_flash imports after maybe_unpack() call to ensure /app
is in sys.path before importing modules that may have torch imports
at module level.

Fixes: No module named 'torch' errors during execution
@deanq deanq requested a review from Copilot February 10, 2026 22:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reorders imports in the load balancer handler to prevent Torch-related import failures by ensuring /app is added to sys.path via maybe_unpack() before importing runpod_flash.

Changes:

  • Moved runpod_flash and RemoteExecutor imports to occur after maybe_unpack()
  • Added inline comments explaining the required import order
  • Added # noqa: E402 to suppress “import not at top of file” lint errors

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@deanq deanq merged commit f1bd8a3 into main Feb 10, 2026
12 checks passed
@deanq deanq deleted the deanq/ae-2079-fix-wrongful-local-execution branch February 10, 2026 23:00
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.

2 participants

Comments