MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / test_4bit_embedding_warnings

Function test_4bit_embedding_warnings

tests/test_modules.py:437–448  ·  view source on GitHub ↗
(device, caplog)

Source from the content-addressed store, hash-verified

435
436@pytest.mark.parametrize("device", get_available_devices())
437def test_4bit_embedding_warnings(device, caplog):
438 num_embeddings = 128
439 default_block_size = 64
440
441 with caplog_at_level(caplog, logging.WARNING, "bitsandbytes.nn.modules"):
442 net = bnb.nn.Embedding4bit(
443 num_embeddings=num_embeddings, embedding_dim=default_block_size + 1, quant_type="nf4"
444 )
445 net.to(device)
446 inp = torch.randint(low=0, high=num_embeddings, size=(1,), device=device)
447 net(inp)
448 assert any("inference" in msg for msg in caplog.messages)
449
450
451@pytest.mark.parametrize("device", get_available_devices(no_cpu=True))

Callers

nothing calls this directly

Calls 2

caplog_at_levelFunction · 0.85
toMethod · 0.45

Tested by

no test coverage detected