Repository navigation
Rename the Python package npu_lora to npu_train; keep npu_lora as a deprecated alias - #47
Open
gspark-etri wants to merge 1 commit into
Open
gspark-etri wants to merge 1 commit into
gspark-etri wants to merge 1 commit into
Conversation
…eprecated alias (#46) - git mv npu_lora npu_train; imports, Helm job, k8s manifest, vendor script, docs and tests use npu_train. - pyproject: distribution npu-train, packages npu_train + npu_lora, CLI npu-train added next to npu-lora, airm workload npu-lora -> npu_train.airm:train. - npu_lora/__init__.py: DeprecationWarning plus a meta-path finder that maps npu_lora.X to the same module object as npu_train.X, so `import npu_lora.X` and `python -m npu_lora.X` keep working; files that exist only under npu_lora/ still resolve there; falls back to the sibling directory for editable installs made before the rename. - tests/test_compat.py covers these cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
The repository is
ai-computing/npu-trainand trains with LoRA, full fine-tuning and MoE, but the Python package was stillnpu_lora. People runpython3 -m npu_lora.<module> ...on shared hosts right now (for examplenpu_lora.moe_bench2, a script copied into the package directory), and some hosts have an editable install made before the rename, so the old name must keep working (#46).Changes
git mv npu_lora npu_train. The package uses relative imports, so the modules are unchanged apart from docstrings/usage lines;k8s.pynow mounts the ConfigMap at/opt/npu-lora/npu_trainand runspython3 -m npu_train.cli; the Helm job runsnpu_train.cli.pyproject.toml: distributionnpu-train; packagesnpu_train*andnpu_lora*; CLInpu-trainadded,npu-lorakept; airm workloadnpu-loranow points atnpu_train.airm:train. Helminstall.pipinstallsnpu-train @ git+....npu_lora/__init__.pyis a compatibility shim:DeprecationWarningon import;npu_lora.Xresolves to the same module object asnpu_train.X(one copy of every class/global;__spec__staysnpu_train.X), and runpy gets the code from it, sopython -m npu_lora.Xrunsnpu_train.Xas__main__;npu_lora/(an untracked script left there on a host, e.g.moe_bench2.py) is still found there and can importnpu_lora.*/ relative names;npu_trainis not importable (editable install made before the rename maps onlynpu_lora), it appends the sibling directory tosys.path;npu_lora.LoRATrainer,__version__) come fromnpu_train.tests/test_compat.py(new, 4 tests, each in a fresh interpreter): import + warning + module identity;python -m npu_lora.cli --helpandpython -m npu_lora.compare --help; a script insidenpu_lora/run with-m; an old-style editable finder that maps onlynpu_lora.docs/,ai-rm.yamlcomment,scripts/vendor-into-lmd-top.sh(copiesnpu_train/*.py, destinationassets/npu-loraunchanged) and the STATUS goal line usenpu_train.Verification
pip install -e .; the host's oldnpu-loraeditable install excluded so entry-point metadata comes from this branch).CUDA_VISIBLE_DEVICES= python -m pytest -q testscpu-tests, Python 3.11, CPU torch): 38 passed (run 39713975072).test_compat.py). Python 3.10.12, torch 2.10.0+cu128 (CPU only, no NPU/GPU used), transformers 5.1.0.npu-lora0.1.0 editable install still registered) the same run gives 37 passed, 1 failed:test_airm.py::test_registry_loads_runnersees the stale entry pointnpu_lora.airm:train. That is the installed metadata, not the code; it goes away after reinstalling (see below). CI installs fresh.sys.pathfallback failstest_old_editable_install_mapping_only_npu_lora; removing the__spec__restore failstest_import_old_name_is_same_module_and_warns.npu-train --help,npu-lora --help,python -m npu_lora.cli --helpfrom outside the repo in the venv;npu_train.k8s.build(...)emitsnpu_train.cliand the/opt/npu-lora/npu_trainmount;scripts/vendor-into-lmd-top.sh <tmpdir>copies the 17 modules.helm templatenot run (helm not installed on this host).check_sensitive.py): clean, no new findings.Compatibility and limits
npu-lora, ai-rm workload namenpu-lora, Prometheus metricsnpu_lora_*,npu_lora_meta.json,NPU_LORA_RNGD*env vars, cache dir~/.cache/npu-lora, Helm chart name/pathdeploy/helm/npu-lora, lmd-top vendoring pathassets/npu-lora.experiments/(they document what was run; theirpython3 -m npu_lora.*commands keep working through the shim).npu-traincommand):pip uninstall -y npu-lora && pip install -e .(otherwise two distributions register thenpu-loracommand and workload).DeprecationWarningfollows Python's default filters: shown whennpu_lorais imported from__main__code or under pytest /-W default, hidden forpython -m npu_lora.X.Related Issue
Closes #46
Checklist
🤖 Generated with Claude Code