audit_clm_alignment
Audit target pairs or DataFrame rows for decoder-only CLM divergence alignment.
Diagnostic utility to inspect which rows are single-token, multi-token aligned, or unalignable (invalid).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tokenizer
|
Any
|
Tokenizer used for evaluation/training. |
required |
pairs_or_df
|
Any
|
DataFrame with factual/alternative (and optionally masked) columns, or an iterable of (factual, alternative) string tuples or dicts. |
required |
context_prefix
|
str
|
Default context prefix if not present in the row. |
''
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns ['factual', 'alternative', 'prefix', 'factual_ids', |
DataFrame
|
'alternative_ids', 'n', 'm', 'k', 'status', 'reason']. |
DataFrame
|
'status' is one of: |
DataFrame
|
|
DataFrame
|
|
DataFrame
|
|
Source code in gradiend/trainer/text/prediction/clm_alignment.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | |
ClmAlignmentError
ClmAlignmentError(message, *, factual=None, alternative=None, context_prefix=None, factual_ids=None, alternative_ids=None, k=None, reason=None)
Bases: ValueError
Raised when factual and alternative targets cannot be contrastively aligned for CLM.