[tests] add require_bitsandbytes marker (#30116)
* add bnb flag * move maker * add accelerator maker
This commit is contained in:
@@ -23,6 +23,7 @@ from parameterized import parameterized
|
|||||||
from transformers import PersimmonConfig, is_torch_available, set_seed
|
from transformers import PersimmonConfig, is_torch_available, set_seed
|
||||||
from transformers.testing_utils import (
|
from transformers.testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
|
require_bitsandbytes,
|
||||||
require_torch,
|
require_torch,
|
||||||
require_torch_accelerator,
|
require_torch_accelerator,
|
||||||
require_torch_fp16,
|
require_torch_fp16,
|
||||||
@@ -465,6 +466,8 @@ class PersimmonModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTester
|
|||||||
@require_torch
|
@require_torch
|
||||||
class PersimmonIntegrationTest(unittest.TestCase):
|
class PersimmonIntegrationTest(unittest.TestCase):
|
||||||
@slow
|
@slow
|
||||||
|
@require_torch_accelerator
|
||||||
|
@require_bitsandbytes
|
||||||
def test_model_8b_chat_logits(self):
|
def test_model_8b_chat_logits(self):
|
||||||
input_ids = [1, 306, 4658, 278, 6593, 310, 2834, 338]
|
input_ids = [1, 306, 4658, 278, 6593, 310, 2834, 338]
|
||||||
model = PersimmonForCausalLM.from_pretrained(
|
model = PersimmonForCausalLM.from_pretrained(
|
||||||
@@ -492,6 +495,7 @@ class PersimmonIntegrationTest(unittest.TestCase):
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_accelerator
|
@require_torch_accelerator
|
||||||
@require_torch_fp16
|
@require_torch_fp16
|
||||||
|
@require_bitsandbytes
|
||||||
def test_model_8b_chat_greedy_generation(self):
|
def test_model_8b_chat_greedy_generation(self):
|
||||||
EXPECTED_TEXT_COMPLETION = """human: Simply put, the theory of relativity states that?\n\nadept: The theory of relativity states that the laws of physics are the same for all observers, regardless of their relative motion."""
|
EXPECTED_TEXT_COMPLETION = """human: Simply put, the theory of relativity states that?\n\nadept: The theory of relativity states that the laws of physics are the same for all observers, regardless of their relative motion."""
|
||||||
prompt = "human: Simply put, the theory of relativity states that?\n\nadept:"
|
prompt = "human: Simply put, the theory of relativity states that?\n\nadept:"
|
||||||
|
|||||||
Reference in New Issue
Block a user