Skip to content
Open
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f47a895
[feat] SID: add offline codebook collision-prevention tool
WhiteSwan1 Jul 6, 2026
2a2e4de
[refactor] SID collision tool: use off-the-shelf readers/writers, dro…
WhiteSwan1 Jul 8, 2026
96abd9d
[chore] SID collision tool: dedup writer boilerplate, drop dead CLI arg
WhiteSwan1 Jul 8, 2026
3377828
[perf] SID collision tool: memoize candidate sort key
WhiteSwan1 Jul 8, 2026
a6ced50
[perf] SID collision tool: project raw-read columns via selected_cols
WhiteSwan1 Jul 8, 2026
d69d2af
[refactor] SID collision tool: derive writer from reader when unset
WhiteSwan1 Jul 8, 2026
f9de751
[refactor] SID collision tool: read candidates from the single input …
WhiteSwan1 Jul 8, 2026
5e024e5
[refactor] SID collision tool: drop --code_fields (single code column…
WhiteSwan1 Jul 8, 2026
2051594
[perf] SID collision tool: mechanical wins (slots, interning, single-…
WhiteSwan1 Jul 9, 2026
d8b70b0
[perf] SID collision tool: restructure the assignment loop (sort once)
WhiteSwan1 Jul 9, 2026
90f17d9
[perf] SID collision tool: two-pass load (candidates only for overflo…
WhiteSwan1 Jul 9, 2026
5d8f95f
[feat] SID collision tool: tuple[int] bucket key + list<int64> I/O (C…
WhiteSwan1 Jul 9, 2026
c4e14e1
Merge branch 'master' into feat/sid_collision_prevention
WhiteSwan1 Jul 9, 2026
cd3f503
[perf] SID collision tool: vectorized within-band greedy reassignment
WhiteSwan1 Jul 9, 2026
ba2bdf1
[refactor] SID collision tool: declare shape via --codebook; private …
WhiteSwan1 Jul 10, 2026
5c67d6d
[refactor] add SID collision grouping outputs
WhiteSwan1 Jul 13, 2026
31b2e61
[refactor] simplify SID collision resolution
WhiteSwan1 Jul 13, 2026
749a139
[doc] add SID append refactoring plan
WhiteSwan1 Jul 14, 2026
11989c5
[refactor] clarify SID collision plan field names and trim dead code
WhiteSwan1 Jul 16, 2026
a1106a0
[refactor] drop unused diagnostics output from SID collision tool
WhiteSwan1 Jul 16, 2026
52a1149
Merge upstream/master (alibaba/TorchEasyRec) into feat/sid_collision_…
WhiteSwan1 Jul 16, 2026
c607459
[chore] drop SID append design-plan docs
WhiteSwan1 Jul 16, 2026
379eb3d
[chore] keep tools/sid/__init__.py identical to upstream
WhiteSwan1 Jul 16, 2026
02bb1a7
[refactor] SID collision: keep_original as the only unassigned policy
WhiteSwan1 Jul 16, 2026
29ebb32
[refactor] SID collision: fold keep-original into the greedy pass
WhiteSwan1 Jul 16, 2026
b8e2499
[refactor] flatten SID candidate_codes to a single list<int> wire format
WhiteSwan1 Jul 16, 2026
ff77872
[bugfix] SID collision tool: validate inputs against the declared cod…
WhiteSwan1 Jul 16, 2026
d464627
[chore] SID collision tool: cover 3-layer band fold and rate-only ove…
WhiteSwan1 Jul 16, 2026
d822597
[chore] SID collision tool: compact repeated test code rows
WhiteSwan1 Jul 16, 2026
899b9cf
[chore] SID collision tool: collapse the _within_bucket_rank return
WhiteSwan1 Jul 16, 2026
d54ef58
[bugfix] SID collision tool: reject output-into-input and multi-proce…
WhiteSwan1 Jul 17, 2026
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
2 changes: 1 addition & 1 deletion tzrec/models/sid_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _sid_predictions(
"""Build SID prediction tensors from a quantizer output."""
predictions = {"codes": quant.cluster_ids}
if quant.candidate_codes is not None and quant.candidate_scores is not None:
predictions["candidate_codes"] = quant.candidate_codes
predictions["candidate_codes"] = quant.candidate_codes.flatten(1)
Comment thread
WhiteSwan1 marked this conversation as resolved.
predictions["candidate_scores"] = quant.candidate_scores
return predictions

Expand Down
4 changes: 2 additions & 2 deletions tzrec/models/sid_rqkmeans_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ def test_inference_candidate_output_opt_in(self) -> None:
set(preds.keys()), {"codes", "candidate_codes", "candidate_scores"}
)
self.assertEqual(preds["codes"].shape, (B, 2))
self.assertEqual(preds["candidate_codes"].shape, (B, 3, 2))
self.assertEqual(preds["candidate_codes"].shape, (B, 6)) # (B, topk*n_layers)
self.assertEqual(preds["candidate_scores"].shape, (B, 3))
torch.testing.assert_close(preds["candidate_codes"][:, 0, :], preds["codes"])
torch.testing.assert_close(preds["candidate_codes"][:, :2], preds["codes"])

def test_candidate_output_topk_exceeds_codebook_raises(self) -> None:
"""Reject topk above the last-layer codebook size at construction."""
Expand Down
8 changes: 5 additions & 3 deletions tzrec/models/sid_rqvae_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,12 @@ def test_rqvae_export_trace_keeps_candidate_output(self) -> None:
{"codes", "candidate_codes", "candidate_scores"},
)
self.assertEqual(set(traced_predictions.keys()), set(predictions.keys()))
self.assertEqual(traced_predictions["candidate_codes"].shape, (B, 3, 2))
self.assertEqual(
traced_predictions["candidate_codes"].shape, (B, 6)
) # (B, topk*n_layers)
self.assertEqual(traced_predictions["candidate_scores"].shape, (B, 3))
torch.testing.assert_close(
traced_predictions["candidate_codes"][:, 0, :],
traced_predictions["candidate_codes"][:, :2],
traced_predictions["codes"],
)

Expand All @@ -268,7 +270,7 @@ def test_rqvae_candidate_scores_sorted(self) -> None:
self.assertEqual(
set(preds.keys()), {"codes", "candidate_codes", "candidate_scores"}
)
self.assertEqual(preds["candidate_codes"].shape, (B, 3, 2))
self.assertEqual(preds["candidate_codes"].shape, (B, 6)) # (B, topk*n_layers)
self.assertEqual(preds["candidate_scores"].shape, (B, 3))
scores = preds["candidate_scores"]
# Slot 0 is the best-scored (nearest) neighbor: minimum score, sorted.
Expand Down
Loading
Loading