Skip to content

fix: import os before updating sys.path in DIT latent script#87

Open
peter941221 wants to merge 1 commit into
Cerebras:mainfrom
peter941221:fix/dit-import-order
Open

fix: import os before updating sys.path in DIT latent script#87
peter941221 wants to merge 1 commit into
Cerebras:mainfrom
peter941221:fix/dit-import-order

Conversation

@peter941221

@peter941221 peter941221 commented Jun 10, 2026

Copy link
Copy Markdown

Bug

create_imagenet_latents.py appends to sys.path with os.path.join(...) before import os.

On current main, that crashes at import time with:
NameError: name 'os' is not defined

vae_hf_cs.py already fixed the same import-order bug, but this DIT latent script still has the broken order.

Fix

Move import os above the sys.path.append(...) call in create_imagenet_latents.py.

This keeps the script behavior the same apart from removing the import-time failure.

Verification

On origin/main:
python3 src/cerebras/modelzoo/data_preparation/vision/dit/create_imagenet_latents.py

fails immediately with:
NameError: name 'os' is not defined

On this branch, the same command gets past that line and fails later in the current environment with:
ModuleNotFoundError: No module named 'torch'

I also ran:
python3 -m py_compile src/cerebras/modelzoo/data_preparation/vision/dit/create_imagenet_latents.py

@peter941221 peter941221 marked this pull request as ready for review June 10, 2026 02:52
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