Add integration tests for MuseGlimmerAssistantModel (#48796)
* Add integration tests for MuseGlimmerAssistantModel
Two tests:
1. test_drafter_forward_output_shape: standalone drafter forward with
synthetic inputs — checks output shape [1, block_size, hidden_size]
and all-finite values. No main model needed.
2. test_dflash_speculative_generation: end-to-end DFlash pipeline with
main model + drafter via generate(..., speculation_type="dflash").
Expected prefix is identical to the greedy-decode reference in
MuseGlimmerIntegrationTest (DFlash is lossless by design).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix imports: cleanup/slow/require_torch_accelerator from testing_utils
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Use 70% GPU memory cap in get_model() to avoid forward-pass OOM
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Use 80% GPU cap + no disk offload to avoid meta-tensor OOM in DFlash test
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Try 90% GPU memory cap
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Load main model in 4-bit to fit on single 24 GiB accelerator
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* style: ruff line-length fix
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Use MemoryCleanupMixin instead of manual setUp/tearDown cleanup calls
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Drop redundant tearDownClass: MemoryCleanupMixin handles it via __init_subclass__
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Move expected string into test; add clarifying comments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Use Expectations class; compare full completion; clarify prompt-strip slice
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Remove stale comment about 70% memory cap (now using 4-bit loading)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* style: ruff line-length fix
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Address vasqu review: trim docstrings and inline comments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Remove with torch.no_grad() from integration test
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Remove test_drafter_forward_output_shape (unit-test concern, not integration)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Trim docstring; move reference note to inline comment
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Keep Expectations key on one line with fmt: off/on
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Move fmt: off/on around the full Expectations block
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Remove verbose comment from get_model
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>