Download expansion_v2/experiments/contextual-discourse/source/build_runtime_package.py from Giuliocc/doxa-methods: direct link, hf CLI and curl.
- Browser
- Download file 900 Bytes
-
https://huggingface.co/datasets/Giuliocc/doxa-methods/resolve/main/expansion_v2/experiments/contextual-discourse/source/build_runtime_package.py
- Command line
-
hf download hf://datasets/Giuliocc/doxa-methods/expansion_v2/experiments/contextual-discourse/source/build_runtime_package.py
-
curl -L -o build_runtime_package.py https://huggingface.co/datasets/Giuliocc/doxa-methods/resolve/main/expansion_v2/experiments/contextual-discourse/source/build_runtime_package.py
900 Bytes
| """Build a small namespaced runtime without training or global imports.""" | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parent | |
| def build(destination): | |
| destination = Path(destination) / "doxa_discourse" | |
| destination.mkdir(parents=True, exist_ok=True) | |
| (destination / "__init__.py").write_text('"""Local contextual-discourse source-task runtime."""\nfrom .runtime import DiscourseModel\n\n__all__ = ["DiscourseModel"]\n') | |
| for source, target in (("contracts.py", "contracts.py"), ("inputs.py", "inputs.py"), ("inference.py", "runtime.py")): | |
| content = (ROOT / source).read_text() | |
| content = content.replace("from contracts import ", "from .contracts import ").replace("from inputs import ", "from .inputs import ") | |
| (destination / target).write_text(content) | |
| return destination | |
| if __name__ == "__main__": | |
| print(build(ROOT / "python_runtime")) | |