Spaces:
Running
Running
solves import error
Browse files27 unmodified lines282930313233343536373839404127 unmodified lines# Ensure project root and config package are importable for configs that do `from config...` importsproject_root = Path(__file__).resolve().parents[2]if str(project_root) not in sys.path:sys.path.insert(0, str(project_root))config_dir = project_root / "config"if str(config_dir) not in sys.path:sys.path.insert(0, str(config_dir))# Ensure 'src' is importable for modules like 'monitoring', 'model', etc.src_dir = project_root / "src"if str(src_dir) not in sys.path:sys.path.insert(0, str(src_dir))# Reduce tokenizer thread contention and improve CUDA allocator behavioros.environ.setdefault("TOKENIZERS_PARALLELISM", "false")27 unmodified lines2829303132333435363738394041424344454647484950515227 unmodified lines# Ensure project root and config package are importable for configs that do `from config...` importsproject_root = Path(__file__).resolve().parents[2]if str(project_root) not in sys.path:# Put project root early so top-level packages like `config` can be resolvedsys.path.insert(0, str(project_root))config_dir = project_root / "config"if str(config_dir) not in sys.path:# Ensure the actual `config` package takes precedence over any `config.py` module elsewheresys.path.insert(0, str(config_dir))# Ensure 'src' is importable for modules like 'monitoring', 'model', etc., but do not shadow `config`src_dir = project_root / "src"if str(src_dir) not in sys.path:# Append to the end to avoid overshadowing the `config` package with `src/config.py`sys.path.append(str(src_dir))# If a stray 'config' module (e.g., from src/config.py) is already imported, remove it so# that the real package `config/` (with __init__.py) can be imported with submodules.try:if 'config' in sys.modules and not hasattr(sys.modules['config'], '__path__'):del sys.modules['config']except Exception:pass# Reduce tokenizer thread contention and improve CUDA allocator behavioros.environ.setdefault("TOKENIZERS_PARALLELISM", "false")
scripts/training/train_gpt_oss.py+13-2