[bnb] Fix bnb config json serialization (#24137)
* fix bnb config json serialization * forward contrib credits from discussions --------- Co-authored-by: Andrechang <Andrechang@users.noreply.github.com>
This commit is contained in:
@@ -111,6 +111,19 @@ class Bnb4BitTest(Base4bitTest):
|
||||
gc.collect()
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
def test_quantization_config_json_serialization(self):
|
||||
r"""
|
||||
A simple test to check if the quantization config is correctly serialized and deserialized
|
||||
"""
|
||||
config = self.model_4bit.config
|
||||
|
||||
self.assertTrue(hasattr(config, "quantization_config"))
|
||||
|
||||
_ = config.to_dict()
|
||||
_ = config.to_diff_dict()
|
||||
|
||||
_ = config.to_json_string()
|
||||
|
||||
def test_memory_footprint(self):
|
||||
r"""
|
||||
A simple test to check if the model conversion has been done correctly by checking on the
|
||||
|
||||
@@ -118,6 +118,19 @@ class MixedInt8Test(BaseMixedInt8Test):
|
||||
gc.collect()
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
def test_quantization_config_json_serialization(self):
|
||||
r"""
|
||||
A simple test to check if the quantization config is correctly serialized and deserialized
|
||||
"""
|
||||
config = self.model_8bit.config
|
||||
|
||||
self.assertTrue(hasattr(config, "quantization_config"))
|
||||
|
||||
_ = config.to_dict()
|
||||
_ = config.to_diff_dict()
|
||||
|
||||
_ = config.to_json_string()
|
||||
|
||||
def test_memory_footprint(self):
|
||||
r"""
|
||||
A simple test to check if the model conversion has been done correctly by checking on the
|
||||
|
||||
Reference in New Issue
Block a user