10 Commits
Author SHA1 Message Date
Reithan 1be05ad7d2 v1.1.0: Unify NRS on a single v-space path (EPS/V/X0) + X0 support; defaults 2/4/0.5 (#44)
## Summary
Collapses the experimental three-mode EPS switch
(`current`/`identity`/`true_v`) into a single, mathematically-correct
v-prediction-space path used by **all** variance-preserving
parameterizations — EPS, v-pred, and x0.

The sampler hook delivers `cond`/`uncond` as `x - x0` for every VP
parameterization, so NRS recovers the true velocity `v = (cond -
A)/factor` (with `A = x·σ²/(σ²+1)`, `factor = σ/√(σ²+1)`), runs its
geometry in v-space, and inverts exactly on return. This replaces the
prior EPS-only affine that operated on the wrong input space.

## Version: 1.1.0
MINOR, not a patch: this adds **X0 (sample) prediction support** — a new
backward-compatible capability — and **changes the default parameters**
(2/5/0.75 → 2/4/0.5). The node interface is unchanged (`eps_mode` never
shipped in 1.0.0), so it is **not** breaking/MAJOR. `pyproject.toml` and
`NRS/nodes_NRS.py __version__` are bumped to `1.1.0` in this PR; the
registry publish is triggered by the merge/release process, not by this
branch.

## Changes
- **`NRS/nodes_NRS.py`**: two-branch conversion — FLOW/CONST operated
natively (identity); all VP types (EPS/V/X0, UNKNOWN→VP) share one
true-v-space transform. Implements X0 (removes the
`NotImplementedError`). Removes `eps_mode` from every method and the
`nrs()` call. New defaults **skew 2 / stretch 4 / squash 0.5**.
- **`scripts/negative_rejection_steering_script.py`** (Forge/A1111):
removes the `eps_mode` test radio, process args, XYZ axis, and
extra-param; reverts `patch()` to 4 args; defaults 2/4/0.5.
- **`tests/test_pred_type.py`**: rewritten for the unified path — FLOW
is the sole native branch; EPS/V/X0/UNKNOWN all run the algebra.
- **`README.md`**: rewrites the V-Space step (now covers EPS/v-pred/x0
identically; flow-matching stays native) and updates the default to
2/4/0.5.
- **`CHANGELOG.md`**: `[1.1.0]` entry.
- **`pyproject.toml` / `NRS/nodes_NRS.py`**: version bumped 1.0.0 →
1.1.0.

## Rationale
Empirical A/B on an EPS checkpoint showed the true-v path is weakly
dominant: equal in normal ranges, burn-resistant at the failure edge,
and unlocks an on-style high-detail regime via squash (squash becomes a
detail/steering knob because the offset `A` is unscaled).

## Validation
- 39 passed / 9 skipped locally (torch tests skip; CI runs them).
Branch-coverage gate passed on push.
- ⚠️ **v-pred and x0 in v-space are math-validated but not yet
image-validated** — recommend a spot-check on a v-pred checkpoint before
merge/release.
2026-09-03 05:30:03 -07:00
Reithan 244f8c656f Fix NODE_DISPLAY_NAME_MAPPINGS typo and NRS skew log label (#43)
## Summary
Applies `.claude/patches/nrs-display-name-and-log-fix.patch`, fixing two
small defects:

- **`__init__.py`** — corrects the `NODE_DISPLAY_NAME_MAPPINS` typo to
`NODE_DISPLAY_NAME_MAPPINGS`. The misspelled name meant ComfyUI never
picked up the human-readable display name, and `__all__` exported a name
that didn't exist.
- **`scripts/negative_rejection_steering_script.py`** — the debug log
labeled `self.skew` as "Squash"; now correctly labeled "Skew".

## Test plan
- Pre-commit + pre-push hooks (ruff, pytest branch-coverage gate) passed
on push.
2026-09-03 01:49:16 -07:00
Reithan ee6dc40393 Add git hooks and development infrastructure (#32)
## Summary

Establishes a complete development infrastructure for the project with
automated quality checks, testing, and contributor guidelines.

- Add pre-commit hooks for automated linting and quality checks
- Configure ruff for code linting and formatting (120 char line length,
Python 3.10+)
- Set up pytest with mocked torch/gradio dependencies for CI/CD
compatibility
- Create comprehensive CONTRIBUTING.md with setup instructions and
workflow guidance
- Add uv.lock for reproducible dependency resolution
- Replace trivial tests with functional interface tests

## Key Components

### Git Hooks (.pre-commit-config.yaml)
- Pre-commit: ruff linting/formatting, trailing whitespace, YAML
validation, prevents direct commits to main
- Pre-push: runs pytest test suite, prevents direct pushes to main

### Testing (tests/)
- Functional tests for ComfyUI node and WebUI script interfaces
- Mock torch, gradio, and WebUI modules via conftest.py (no heavy
dependencies in dev env)
- Tests verify API contracts without requiring full ComfyUI/WebUI
runtime

### Documentation (CONTRIBUTING.md)
- Development setup with uv package manager
- Git workflow and branch protection guidelines
- Linting, testing, and pre-commit hook usage
- Code style guidelines and commit message conventions

## Test Plan

- [x] Pre-commit hooks run on commit (linting, formatting, checks)
- [x] Pre-push hooks run pytest successfully
- [x] All tests pass in isolated venv
- [x] CONTRIBUTING.md instructions verified
- [x] No IDE diagnostics or issues
2026-05-15 16:08:45 -07:00
Reithan c83958c457 Update default parameter values for NRS node and script (#26)
Updates the default parameter values for the Negative Rejection Steering
implementation to improve usability and user experience.

## Changes
- **Skew**: 4.0 → 2.00
- **Stretch**: 2.0 → 5.00  
- **Squash**: 0.0 → 0.75

These new defaults (2/5/0.75) provide a better starting point for users,
as documented in the updated README.

## Files Modified
- `NRS/nodes_NRS.py`: Updated default values in INPUT_TYPES
- `scripts/negative_rejection_steering_script.py`: Updated default
initialization values
- `README.md`: Updated beginner how-to guide to reference the new
defaults

---------

Signed-off-by: Reithan <bo122081@hotmail.com>
2026-02-13 17:36:43 -08:00
Reithan 50ddd2ac47 Update math to 0.5.0 (#10)
- [X] detects v-pred/eps and uses appropriate pre/post scaling
- [X] supports detection in Forge, Comfy and various loaders/models
2025-07-19 17:59:27 -07:00
Reithan 3768f4a768 Update ComfyUI compatibility (#5) 2025-04-13 22:13:50 -07:00
Reithan e82622cefe Update negative_rejection_steering_script.py 2025-03-29 05:13:16 -07:00
Reithan e6cdf03189 Update module UI style (#2)
Update module UI style
2025-03-22 01:47:42 -07:00
Reithan 78dde5adaa Alpha implementation 2025-03-21 19:58:30 -07:00
Reithan cfa271cb28 Initial implementation with tweaking 2025-03-21 04:12:17 -07:00