MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / injection_assert

Function injection_assert

tests/unit/linear/test_ctx.py:25–32  ·  view source on GitHub ↗
(model)

Source from the content-addressed store, hash-verified

23
24
25def injection_assert(model):
26 # pick out random linear that should have been replaced and initialized
27 q_proj = model.model.layers[1].self_attn.q_proj
28
29 assert isinstance(q_proj, LoRAOptimizedLinear), "injection did not happen"
30 assert q_proj._initialized, "lora was not initialized properly"
31 assert isinstance(q_proj.lora_weight_1, torch.nn.Linear)
32 assert isinstance(q_proj.lora_weight_2, torch.nn.Linear)
33
34
35class TestEngine(DistributedTest):

Callers 2

test_pretrained_initMethod · 0.85
test_config_initMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected