Spaces:
Sleeping
Sleeping
Download src/deep_learning/pipeline/runner.py from yetrun/general-deep-learning: direct link, hf CLI and curl.
- Browser
- Download file 690 Bytes
-
https://huggingface.co/spaces/yetrun/general-deep-learning/resolve/main/src/deep_learning/pipeline/runner.py
- Command line
-
hf download hf://spaces/yetrun/general-deep-learning/src/deep_learning/pipeline/runner.py
-
curl -L -o runner.py https://huggingface.co/spaces/yetrun/general-deep-learning/resolve/main/src/deep_learning/pipeline/runner.py
690 Bytes
| from .specs import Pipeline | |
| from deep_learning.env.runner import ActionRunner, action | |
| class PipelineRunner(ActionRunner): | |
| def __init__(self, pipeline: Pipeline): | |
| self.pipeline = pipeline | |
| def train(self): | |
| return self.pipeline.train() | |
| def export(self): | |
| model_path = self.pipeline.export_model() | |
| print(f"模型已导出到: {model_path}") | |
| return model_path | |
| def test(self, checkpoint: str = "test"): | |
| if checkpoint not in ["train", "test"]: | |
| raise ValueError("test 动作的 checkpoint 只支持 train 或 test") | |
| return self.pipeline.test_examples(checkpoint=checkpoint) | |