Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6a63da5
feat: add checker_online & fix: typos
YinjieZhao22 Jul 14, 2025
2bcb59e
feat: add onlinechecker fold & add comments
YinjieZhao22 Jul 14, 2025
0d463cc
update: base_cls
YinjieZhao22 Jul 14, 2025
6e394d9
update: consistency relation
YinjieZhao22 Jul 15, 2025
20c3036
update: consistency_transient_vars
YinjieZhao22 Jul 15, 2025
cbbbc7d
update: contain relation & feat: online checker install
YinjieZhao22 Jul 15, 2025
5c48afd
update: cover relation
YinjieZhao22 Jul 15, 2025
1387629
update: lead relation
YinjieZhao22 Jul 15, 2025
0fc63fb
update: distinct argument relation
YinjieZhao22 Jul 15, 2025
0eb036b
fix: inconsistent apis
YinjieZhao22 Jul 15, 2025
37ba5d4
feat: get_meta_vars_online
YinjieZhao22 Jul 15, 2025
72c0517
fix: str don't have contains
YinjieZhao22 Jul 15, 2025
420272d
fix: set context map
YinjieZhao22 Jul 15, 2025
048fb2e
feat: set_meta_vars_online
YinjieZhao22 Jul 16, 2025
3558e5a
fix: remove deepcopy
YinjieZhao22 Jul 16, 2025
56cb744
feat: add TODO & remove debug information
YinjieZhao22 Jul 17, 2025
b6d2ab7
fix: format & typos
YinjieZhao22 Jul 17, 2025
31649f0
fix: .pre-commit-config
YinjieZhao22 Jul 17, 2025
08b24f4
fix: lead & cover inference logic
Essoz Jul 17, 2025
f760d6f
add: static website generation workflow
Essoz Jul 17, 2025
b258f4b
fix: lead relation generate hypos
YinjieZhao22 Jul 18, 2025
f611275
fix: lead relation
YinjieZhao22 Jul 18, 2025
8e5c552
fix cover relation bug
liurt1218 Jul 19, 2025
80f7349
feat: online check doc
YinjieZhao22 Jul 21, 2025
09044d6
fix: lead & cover relation
YinjieZhao22 Jul 21, 2025
f2e8ec1
refactor: rename APIs to make code more readable
Essoz Jul 22, 2025
2d33acc
rewording checker doc
Essoz Jul 22, 2025
5128641
Merge branch 'main' into onlinechecker_oss
Essoz Jul 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ repos:
args: [--exclude, tests]
# args: [--check]

- repo: local
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
name: isort
entry: isort
language: system
types: [python]
args: [--profile=black, --skip, tests]
args: [--profile=black, --skip=tests]
39 changes: 26 additions & 13 deletions docs/check.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,31 @@

`traincheck-check` is the **final stage** of the TrainCheck workflow. It verifies a set of invariants against trace files or streams from target programs, reporting any detected violations—helping you catch silent issues in your ML training pipelines.

## 🔧 Current Status
## 🔧 Checking Modes

`traincheck-check` is designed to support two modes:
TrainCheck supports two checking modes:

- **Offline Checking**:
Perform invariant checking on completed trace files after the training job finishes. ✅ *[Fully Supported]*
- **Post-training Checking (`traincheck-check`)**:
Perform invariant checking on completed trace files after the training job finishes. ✅

- **Online Checking**:
Perform real-time checking while the target training job is running. 🚧 *[In Development]*
- **On-the-fly Checking (`traincheck-onlinecheck`):**
Perform real-time checking while the target training job is running.

At present, only **offline checking** is available. Support for online mode is actively being developed.
## How to Use: On-the-fly Checking

## How to Use: Offline Checking
While training is in progress with `traincheck-collect`, run the following command:

```bash
traincheck-onlinecheck -f <trace_folder> -i <path_to_invariant_file>
```

- `-f <trace_folder>`: Path to the folder where traces are:
- Already collected, or
- **Actively being collected** by `traincheck-collect` during the training job.

- `-i <path_to_invariant_file>`: Path to the JSON file containing inferred invariants.

## How to Use: Post-training Checking

Run the following command:

Expand All @@ -25,11 +37,12 @@ traincheck-check -f <trace_folder> -i <path_to_invariant_file>
- `-f <trace_folder>`: Path to the folder containing traces collected by `traincheck-collect`.
- `-i <path_to_invariant_file>`: Path to the JSON file containing inferred invariants.

For details on result format and interpretation, refer to [5. Detection & Diagnosis)](./5-min-tutorial.md#5-detection--diagnosis) in the **5-Minute Tutorial**.
## Interpreting the Results

## How to Use: Online Checking
After running either checking mode, TrainCheck will output a summary of detected invariant violations. Each violation entry typically includes:

**🚧 Coming Soon**
Support for real-time, online checking is under construction. This mode will allow TrainCheck to monitor running training jobs and surface invariant violations as they happen.
- **Trace file or stream name**: Identifies where the issue was found.
- **Invariant description**: Details the specific invariant that was violated.
- **Violation details**: Provides context, such as the step or epoch where the violation occurred.

Stay tuned for updates in future releases.
Review these results to pinpoint silent errors or unexpected behaviors in your ML training pipeline. For more information on result formats and how to diagnose issues, see [5. Detection & Diagnosis](./5-min-tutorial.md#5-detection--diagnosis) in the **5-Minute Tutorial**.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ homepage = "https://github.com/OrderLab/TrainCheck"
traincheck-collect = "traincheck:collect_trace.main"
traincheck-infer = "traincheck:infer_engine.main"
traincheck-check = "traincheck:checker.main"
traincheck-onlinecheck = "traincheck:checker_online.main"
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def test_typename_builtin_function():
assert typename(len) == "len"
assert typename(print) == "print"


def test_typename_tensor_and_parameter():
t = torch.tensor([1.0])
assert typename(t) == t.type()
Expand Down
3 changes: 1 addition & 2 deletions traincheck/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def check_engine(
inv.precondition is not None
), "Invariant precondition is None. It should at least be 'Unconditional' or an empty list. Please check the invariant file and the inference process."
logger.info("=====================================")
# logger.debug("Checking invariant %s on trace %s", inv, trace)
res = inv.check(trace, check_relation_first)
res.calc_and_set_time_precentage(trace.get_start_time(), trace.get_end_time())
logger.info("Invariant %s on trace %s: %s", inv, trace, res)
Expand Down Expand Up @@ -147,7 +146,7 @@ def main():
for inv_file in args.invariants:
os.system(f"cp {inv_file} {args.output_dir}/invariants.json")

logger.info("Reading invaraints from %s", "\n".join(args.invariants))
logger.info("Reading invariants from %s", "\n".join(args.invariants))
invs = read_inv_file(args.invariants)

traces = []
Expand Down
Loading