mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-04 05:10:06 +06:00
[Tests] Cleanup Janus Testcase (#38311)
* Cleanup janus testcase * shift code to setup
This commit is contained in:
parent
b59386dc0a
commit
2b585419b4
@ -20,7 +20,6 @@ import unittest
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from transformers import AutoProcessor, AutoTokenizer, JanusProcessor
|
from transformers import AutoProcessor, AutoTokenizer, JanusProcessor
|
||||||
from transformers.models.janus.convert_janus_weights_to_hf import CHAT_TEMPLATE
|
|
||||||
from transformers.utils import is_vision_available
|
from transformers.utils import is_vision_available
|
||||||
|
|
||||||
from ...test_processing_common import ProcessorTesterMixin
|
from ...test_processing_common import ProcessorTesterMixin
|
||||||
@ -45,6 +44,9 @@ class JanusProcessorTest(ProcessorTesterMixin, unittest.TestCase):
|
|||||||
"deepseek-community/Janus-Pro-1B",
|
"deepseek-community/Janus-Pro-1B",
|
||||||
extra_special_tokens=special_image_tokens,
|
extra_special_tokens=special_image_tokens,
|
||||||
)
|
)
|
||||||
|
# Set the processor to use the default system prompt to False as it's used based on input modality.
|
||||||
|
# Hence set to False to avoid any issues in the test irrespective of inputs.
|
||||||
|
processor.use_default_system_prompt = False
|
||||||
processor.save_pretrained(self.tmpdirname)
|
processor.save_pretrained(self.tmpdirname)
|
||||||
|
|
||||||
def get_tokenizer(self, **kwargs):
|
def get_tokenizer(self, **kwargs):
|
||||||
@ -53,11 +55,8 @@ class JanusProcessorTest(ProcessorTesterMixin, unittest.TestCase):
|
|||||||
def get_image_processor(self, **kwargs):
|
def get_image_processor(self, **kwargs):
|
||||||
return AutoProcessor.from_pretrained(self.tmpdirname, **kwargs).image_processor
|
return AutoProcessor.from_pretrained(self.tmpdirname, **kwargs).image_processor
|
||||||
|
|
||||||
def prepare_processor_dict(self):
|
def get_processor(self):
|
||||||
# similar to Emu3 and Qwen2VLProcessorTest, but keep the template in the convert script to avoid duplicated code
|
return AutoProcessor.from_pretrained(self.tmpdirname)
|
||||||
return {
|
|
||||||
"chat_template": CHAT_TEMPLATE,
|
|
||||||
}
|
|
||||||
|
|
||||||
def test_chat_template_single(self):
|
def test_chat_template_single(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user