Stop DOSing the Hub in the CI (#37209)
* As the title suggests, stop hammering the same files * make fixup * Use shutil instead of pathlib
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import io
|
||||
import tempfile
|
||||
import unittest
|
||||
from shutil import rmtree
|
||||
|
||||
import requests
|
||||
|
||||
@@ -32,18 +33,21 @@ if is_torch_available():
|
||||
class FuyuProcessingTest(ProcessorTesterMixin, unittest.TestCase):
|
||||
processor_class = FuyuProcessor
|
||||
|
||||
def setUp(self):
|
||||
self.tmpdirname = tempfile.mkdtemp()
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.tmpdirname = tempfile.mkdtemp()
|
||||
# Ensure tempdir is cleaned up even if there's a failure
|
||||
cls.addClassCleanup(lambda tempdir=cls.tmpdirname: rmtree(tempdir))
|
||||
|
||||
image_processor = FuyuImageProcessor()
|
||||
tokenizer = AutoTokenizer.from_pretrained("adept/fuyu-8b")
|
||||
|
||||
processor = FuyuProcessor(image_processor=image_processor, tokenizer=tokenizer)
|
||||
processor.save_pretrained(self.tmpdirname)
|
||||
processor.save_pretrained(cls.tmpdirname)
|
||||
|
||||
self.text_prompt = "Generate a coco-style caption.\\n"
|
||||
cls.text_prompt = "Generate a coco-style caption.\\n"
|
||||
bus_image_url = "https://huggingface.co/datasets/hf-internal-testing/fixtures-captioning/resolve/main/bus.png"
|
||||
self.bus_image_pil = Image.open(io.BytesIO(requests.get(bus_image_url).content))
|
||||
cls.bus_image_pil = Image.open(io.BytesIO(requests.get(bus_image_url).content))
|
||||
|
||||
def get_processor(self):
|
||||
image_processor = FuyuImageProcessor()
|
||||
|
||||
Reference in New Issue
Block a user