Trim the comments across the diffusion backend

Comment-only pass over the Python this PR touches: drop what the code already
says, collapse multi-line explanations that still read on one line, and keep
the reasoning that is not recoverable from the code. No code, docstring
semantics or behaviour changes; verified with an AST comparison against the
previous revision, and the backend suite is unchanged (same 37 environment
failures as before: the API integration tests that need a live keyed server,
the flash-attn install hooks, and the GPU memory fields).
This commit is contained in:
Daniel Han 2026-07-26 20:30:46 +00:00
commit 36df317293
113 changed files with 3389 additions and 4087 deletions

View file

@ -245,8 +245,8 @@ def test_new_static_shape_redirties_a_hit(monkeypatch, tmp_path, fake_megacache)
assert ctx2.shapes == {(1024, 1024, 1)}
cc.register_shape(ctx2, (1024, 1024, 1), static = True)
assert cc.save(ctx2) is False
# ...but a NEW static shape (its compile just produced new artifacts) does, and the
# rewritten manifest covers both.
# ...but a NEW static shape (its compile just produced new artifacts) does, and the rewritten
# manifest covers both.
cc.register_shape(ctx2, (768, 768, 1), static = True)
assert ctx2.saved is False
assert cc.save(ctx2) is True
@ -255,9 +255,8 @@ def test_new_static_shape_redirties_a_hit(monkeypatch, tmp_path, fake_megacache)
def test_new_batch_size_is_its_own_static_shape(monkeypatch, tmp_path, fake_megacache):
# A static compile produces one artifact PER (w, h, batch): a batched generation at a
# batch size the bundle has not seen (incl. an OOM-backoff half) must re-dirty it, and
# the same (w, h) at the covered batch must not.
# A static compile produces one artifact PER (w, h, batch): a batched generation at an unseen
# batch size (incl. an OOM-backoff half) must re-dirty it, and the covered batch must not.
monkeypatch.setenv(cc._ENV_MODE, "auto")
monkeypatch.delenv(cc._ENV_SAVE, raising = False)
monkeypatch.setenv(cc._ENV_DIR, str(tmp_path))
@ -277,8 +276,8 @@ def test_new_batch_size_is_its_own_static_shape(monkeypatch, tmp_path, fake_mega
def test_gguf_quant_keys_apart_from_dense():
# A GGUF transformer compiles a different graph (the dequant chain) than the dense
# family; the load path fingerprints it quant="gguf" so bundles never cross-hit.
# A GGUF transformer compiles a different graph (the dequant chain) than the dense family; the
# load path fingerprints it quant="gguf" so bundles never cross-hit.
efp = cc.environment_fingerprint()
base = dict(
family = "flux.1",
@ -312,7 +311,7 @@ def test_fingerprint_mismatch_falls_back(monkeypatch, tmp_path, fake_megacache):
ctx = cc.begin(transformer = _transformer(), **_BEGIN_KW)
cc.save(ctx)
# Tamper the manifest's env fingerprint -> exact-match guard must reject the bundle.
# Tamper the manifest's env fingerprint: the exact-match guard must reject the bundle.
manifest = json.loads(ctx.manifest_path.read_text())
manifest["env"]["torch"] = "0.0.0-other"
ctx.manifest_path.write_text(json.dumps(manifest))