(request)
| 174 | |
| 175 | @pytest.fixture(params=get_available_devices(no_cpu=True)) |
| 176 | def 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 | |
| 196 | def test_linear8bit_copy_param(linear8bit): |
no test coverage detected