Draft
Conversation
- New 'cog exec' command replaces old 'cog run' for running arbitrary commands in the Docker environment - New 'cog run' command runs predictions (replaces 'cog predict') - 'cog predict' kept as hidden alias for backwards compatibility - Heuristic detection warns users who try old 'cog run <cmd>' usage and suggests 'cog exec' instead
- Accept both 'run:' and 'predict:' in cog.yaml (cannot set both) - 'run' takes precedence; 'predict' is the legacy name - Update JSON schema to include 'run' property - Update cog init template: generate run.py with BaseRunner class - Update cog.yaml template to use run: 'run.py:Runner' - Add validation tests for run/predict conflict
- Add BaseRunner as the new base class with run() method - BasePredictor is now an alias for BaseRunner (backwards compat) - get_predict() prefers run() over predict(); errors if both defined - Inspector (schema generation) detects run() or predict() on classes - Export BaseRunner from cog package - Add tests for BaseRunner, run(), and dispatch logic
- Add /runs, /runs/{id}, /runs/{id}/cancel as aliases for /predictions
- Emit run_time metric alongside predict_time in all responses
- Both metrics contain the same value for backwards compatibility
- Add test for /runs route and run_time metric presence
Rename the Go prediction package from pkg/predict/ to pkg/run/: - predictor.go → runner.go: Predictor → Runner, NewPredictor → NewRunner, Predict() → Run(), endpoint returns 'runs' - api.go, input.go: package name updated to 'run' Update CLI files that reference the package: - train.go: predict.NewPredictor → run.NewRunner - predict.go: already updated in Phase 1, import verified - build.go: help text 'cog predict' → 'cog run' - init_test.go: expect run.py instead of predict.py from cog init
Update test config strings and assertions across Go test packages: - pkg/config/: config_test, load_test, validate_test use run: key - pkg/dockerfile/: standard_generator_test uses run: 'run.py:Runner' - pkg/util/: overwrite_yaml_test uses run: key - pkg/web/: client_test creates run.py temp files Note: Docker image label JSON continues to use 'predict' key (part of Config struct's json tag), so model/image tests and mock configs that test label parsing are intentionally unchanged.
Rename predict concepts to run across all user-facing and internal docs: - README.md, docs/README.md: run.py:Runner, cog run, BaseRunner - docs/python.md: ~40 substitutions (BaseRunner, def run(), Runner class) - docs/getting-started.md, docs/getting-started-own-model.md - docs/yaml.md: renamed 'predict' config section to 'run' - docs/http.md: predict function → run function - docs/training.md: BaseRunner, cog run - docs/notebooks.md: run.py, BaseRunner - docs/wsl2/wsl2.md: cog run - CONTRIBUTING.md: run.py:Runner, pkg/run/ - AGENTS.md: updated project structure descriptions - crates/README.md: PythonRunner, run() method - architecture/*.md (11 files): updated diagrams and descriptions Preserved as-is: 'prediction' as a noun, /predictions HTTP endpoints, predict_time metric, predictor_ref protocol field, Config.Predict Go field.
Mechanical rename across 106 .txtar test files plus supporting Go files: - cog predict → cog run (prediction commands) - cog run → cog exec (arbitrary command execution in 6 files) - predict: 'predict.py:Predictor' → run: 'run.py:Runner' (cog.yaml) - -- predict.py -- → -- run.py -- (txtar file sections) - from cog import BasePredictor → from cog import BaseRunner - class Predictor(BasePredictor) → class Runner(BaseRunner) - def predict(self → def run(self - Updated comments and docstrings to use runner terminology - integration-tests/README.md: updated examples and descriptions - integration-tests/concurrent/concurrent_test.go: updated config and code
cc3866e to
72c56cf
Compare
72c56cf to
b27ea69
Compare
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.
Summary
Renames the core "predict" concept to "run" across the entire codebase — CLI, Python SDK, Rust coglet, HTTP API, Go internals, docs, and integration tests. Backwards compatibility is maintained, except for the previous behavior of
cog runbeing renamed tocog exec.Key changes
cog runis now the prediction command (oldcog runfor arbitrary commands →cog exec);cog predictkept as hidden aliasrun:andpredict:keys (errors if both set;runpreferred)BaseRunnerclass withdef run()method;BasePredictor/def predict()are aliasesrun()vspredict()method at load time, dispatches accordingly/runs,/runs/{id},/runs/{id}/canceladded as aliases for/predictionsendpointsrun_timeandpredict_time(same value)pkg/predict/renamed topkg/run/viagit mv;Predictor→Runnercog init: generatesrun.pywithBaseRunner/RunnerclassBackwards compatibility
cog predictstill works (hidden alias)predict:key in cog.yaml still worksBasePredictorclass still worksdef predict()method still works/predictionsHTTP endpoints unchangedpredict_timemetric still emittedCommits
Each commit is a logical unit:
cog run→cog exec,cog predict→cog runrunkey to cog.yaml alongside legacypredictkeyBaseRunnerclass andrun()method to Python SDK/runsHTTP endpoints andrun_timemetric; Rust coglet detectsrun()vspredict()pkg/predicttopkg/run(viagit mv)docs/cli.mdanddocs/llms.txtTesting