(self, q_bits)
| 76 | world_size = 2 |
| 77 | |
| 78 | def test(self, q_bits): |
| 79 | input_features = 64 # Number of input features |
| 80 | output_features = 64 # Number of output features |
| 81 | batch_size = 5 # Number of samples in a batch |
| 82 | |
| 83 | lora_config = None |
| 84 | quantization_config = QuantizationConfig(q_bits=q_bits) |
| 85 | quantization_config.q_dtype = FPQuantizerBuilder.get_default_quant_dtype() |
| 86 | |
| 87 | linear_layer = OptimizedLinear(input_dim=input_features, |
| 88 | output_dim=output_features, |
| 89 | lora_config=lora_config, |
| 90 | quantization_config=quantization_config, |
| 91 | dtype=torch.bfloat16) |
| 92 | device = get_accelerator().current_device_name() |
| 93 | linear_layer = linear_layer.to(device) |
| 94 | dummy_input = torch.rand([batch_size, input_features], device=device, dtype=torch.bfloat16) |
| 95 | |
| 96 | output = linear_layer(dummy_input) |
| 97 | assert output.shape == (batch_size, output_features) |
| 98 | |
| 99 | |
| 100 | @pytest.mark.parametrize("base_weight_sharding", [1, 2], ids=['bws1', 'bws2']) |
nothing calls this directly
no test coverage detected