mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-01 02:31:11 +06:00
Fix new BNB test failures (#35345)
This commit is contained in:
parent
5b516b06c8
commit
6b1e86fd4d
@ -172,7 +172,7 @@ class Bnb4BitTest(Base4bitTest):
|
|||||||
mem_fp16 = self.model_fp16.get_memory_footprint()
|
mem_fp16 = self.model_fp16.get_memory_footprint()
|
||||||
mem_4bit = self.model_4bit.get_memory_footprint()
|
mem_4bit = self.model_4bit.get_memory_footprint()
|
||||||
|
|
||||||
self.assertAlmostEqual(mem_fp16 / mem_4bit, self.EXPECTED_RELATIVE_DIFFERENCE)
|
self.assertAlmostEqual(mem_fp16 / mem_4bit, self.EXPECTED_RELATIVE_DIFFERENCE, delta=1e-5)
|
||||||
linear = get_some_linear_layer(self.model_4bit)
|
linear = get_some_linear_layer(self.model_4bit)
|
||||||
self.assertTrue(linear.weight.__class__ == Params4bit)
|
self.assertTrue(linear.weight.__class__ == Params4bit)
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class MixedInt8Test(BaseMixedInt8Test):
|
|||||||
mem_fp16 = self.model_fp16.get_memory_footprint()
|
mem_fp16 = self.model_fp16.get_memory_footprint()
|
||||||
mem_8bit = self.model_8bit.get_memory_footprint()
|
mem_8bit = self.model_8bit.get_memory_footprint()
|
||||||
|
|
||||||
self.assertAlmostEqual(mem_fp16 / mem_8bit, self.EXPECTED_RELATIVE_DIFFERENCE)
|
self.assertAlmostEqual(mem_fp16 / mem_8bit, self.EXPECTED_RELATIVE_DIFFERENCE, delta=1e-5)
|
||||||
self.assertTrue(get_some_linear_layer(self.model_8bit).weight.__class__ == Int8Params)
|
self.assertTrue(get_some_linear_layer(self.model_8bit).weight.__class__ == Int8Params)
|
||||||
|
|
||||||
def test_linear_are_8bit(self):
|
def test_linear_are_8bit(self):
|
||||||
@ -938,8 +938,13 @@ class MixedInt8LlamaTest(MixedInt8Test):
|
|||||||
model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
|
model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
|
||||||
EXPECTED_RELATIVE_DIFFERENCE = 1.7869331026479096
|
EXPECTED_RELATIVE_DIFFERENCE = 1.7869331026479096
|
||||||
EXPECTED_OUTPUTS = set()
|
EXPECTED_OUTPUTS = set()
|
||||||
|
|
||||||
|
# Expected on Intel XPU
|
||||||
EXPECTED_OUTPUTS.add("Hello my name is John Smith and I am a software engineer. I")
|
EXPECTED_OUTPUTS.add("Hello my name is John Smith and I am a software engineer. I")
|
||||||
|
|
||||||
|
# Expected on NVIDIA T4
|
||||||
|
EXPECTED_OUTPUTS.add("Hello my name is John and I am a software engineer. I have")
|
||||||
|
|
||||||
def test_int8_from_pretrained(self):
|
def test_int8_from_pretrained(self):
|
||||||
r"""
|
r"""
|
||||||
Test whether loading a 8bit model from the Hub works as expected
|
Test whether loading a 8bit model from the Hub works as expected
|
||||||
|
Loading…
Reference in New Issue
Block a user