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

Function linear8bit

tests/test_linear8bitlt.py:176–193  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

174
175@pytest.fixture(params=get_available_devices(no_cpu=True))
176def linear8bit(request):
177 device = request.param
178 linear = torch.nn.Linear(32, 96)
179 linear_custom = Linear8bitLt(
180 linear.in_features,
181 linear.out_features,
182 linear.bias is not None,
183 has_fp16_weights=False,
184 threshold=6.0,
185 )
186 linear_custom.weight = bnb.nn.Int8Params(
187 linear.weight.data.clone(),
188 requires_grad=False,
189 has_fp16_weights=False,
190 )
191 linear_custom.bias = linear.bias
192 linear_custom = linear_custom.to(device)
193 return linear_custom
194
195
196def test_linear8bit_copy_param(linear8bit):

Callers 1

test_bench_matmulFunction · 0.85

Calls 2

toMethod · 0.95
Linear8bitLtClass · 0.90

Tested by

no test coverage detected