diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 572ac0e..dc988ce 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -15,7 +15,7 @@ permissions: jobs: build: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@v3 @@ -30,3 +30,6 @@ jobs: - name: Test with pytest run: | cd tests && python pipe_test.py + - name: Test worker + run: | + cd tests && python test_worker.py diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..03f1e94 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM nvidia/cuda:12.0.0-devel-ubuntu22.04 +RUN apt-get update +RUN apt-get install -y curl libicu70 python3 +# needed by opencv +RUN apt-get -y install ffmpeg libsm6 libxext6 +RUN useradd -ms /bin/bash tester +user tester +workdir /tester +RUN mkdir actions-runner && cd actions-runner +RUN curl -o actions-runner-linux-x64-2.317.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.317.0/actions-runner-linux-x64-2.317.0.tar.gz +RUN echo "9e883d210df8c6028aff475475a457d380353f9d01877d51cc01a17b2a91161d actions-runner-linux-x64-2.317.0.tar.gz" | shasum -a 256 -c +RUN tar xzf ./actions-runner-linux-x64-2.317.0.tar.gz +# GITHUB TOKEN +ARG token=vasya +RUN ./config.sh --url https://github.com/singnet/metafusion --token $token +entrypoint /bin/sh diff --git a/multigen/loader.py b/multigen/loader.py index 08d89f0..766ebc0 100644 --- a/multigen/loader.py +++ b/multigen/loader.py @@ -1,7 +1,14 @@ -from typing import Type +from typing import Type, List +import random +import copy from contextlib import nullcontext import torch import logging +import threading +import psutil +import sys +import diffusers + from diffusers import DiffusionPipeline, StableDiffusionControlNetPipeline, StableDiffusionXLControlNetPipeline from diffusers.utils import is_accelerate_available if is_accelerate_available(): @@ -33,39 +40,147 @@ class Loader: class for loading diffusion pipelines from files. """ def __init__(self): - self._pipes = dict() - - def load_pipeline(self, cls: Type[DiffusionPipeline], path, torch_dtype=torch.float16, device=torch.device('cuda' if torch.cuda.is_available() else 'cpu') - , **additional_args): - for key, pipe in self._pipes.items(): - if key == path: - pipe = copy_pipe(pipe) - components = pipe.components - if issubclass(cls, StableDiffusionXLControlNetPipeline) or issubclass(cls, StableDiffusionControlNetPipeline): - # todo: keep controlnets in cache explicitly - if 'controlnet' in additional_args: - components.pop('controlnet') - return cls(**components, **additional_args) - # handling the case when the model in cache has controlnet in it - # but we don't need it - if 'controlnet' in components: - components.pop('controlnet') - return cls(**components, **additional_args) - - if path.endswith('safetensors'): - result = cls.from_single_file(path, **additional_args) - else: - result = cls.from_pretrained(path, **additional_args) - result = result.to(torch_dtype).to(device) - self.register_pipeline(result, path) - result = copy_pipe(result) - return result + self._lock = threading.RLock() + self._cpu_pipes = dict() + # idx -> list of (model_id, pipe) pairs + self._gpu_pipes = dict() + + def get_gpu(self, model_id) -> List[int]: + """ + return list of gpus with loaded model + """ + with self._lock: + result = list() + for idx, items in self._gpu_pipes.items(): + for (model, _) in items: + if model == model_id: + result.append(idx) + return result + + def load_pipeline(self, cls: Type[DiffusionPipeline], path, torch_dtype=torch.float16, device=None, + **additional_args): + with self._lock: + logger.debug(f'looking for pipeline {cls} from {path} on {device}') + result = None + if device is None: + device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') + if device.type == 'cuda': + idx = device.index + gpu_pipes = self._gpu_pipes.get(idx, []) + for (key, value) in gpu_pipes: + if key == path: + logger.debug(f'found pipe in gpu cache {key}') + result = self.from_pipe(cls, value, additional_args) + logger.debug(f'created pipe from gpu cache {key} on {device}') + return result + for (key, pipe) in self._cpu_pipes.items(): + if key == path: + logger.debug(f'found pipe in cpu cache {key}') + result = self.from_pipe(cls, copy.deepcopy(pipe), additional_args) + break + if result is None: + logger.info(f'not found {path} in cache, loading') + if path.endswith('safetensors'): + result = cls.from_single_file(path, **additional_args) + else: + result = cls.from_pretrained(path, **additional_args) + if device.type == 'cuda': + self.clear_cache(device) + result = result.to(dtype=torch_dtype, device=device) + self.cache_pipeline(result, path) + result = copy_pipe(result) + assert result.device == device + logger.debug(f'returning {type(result)} from {path} on {result.device}') + return result + + def from_pipe(self, cls, pipe, additional_args): + pipe = copy_pipe(pipe) + components = pipe.components + if issubclass(cls, StableDiffusionXLControlNetPipeline) or issubclass(cls, StableDiffusionControlNetPipeline): + # todo: keep controlnets in cache explicitly + if 'controlnet' in additional_args: + components.pop('controlnet') + return cls(**components, **additional_args) + # handling the case when the model in cache has controlnet in it + # but we don't need it + if 'controlnet' in components: + components.pop('controlnet') + return cls(**components, **additional_args) - def register_pipeline(self, pipe: DiffusionPipeline, model_id): - self._pipes[model_id] = pipe + def cache_pipeline(self, pipe: DiffusionPipeline, model_id): + with self._lock: + device = pipe.device + if model_id not in self._cpu_pipes: + # deepcopy is needed since Module.to is an inplace operation + size = get_model_size(pipe) + ram = awailable_ram() + if ram < size * 3: + key_to_delete = random.choice(list(self._cpu_pipes.keys())) + self._cpu_pipes.pop(key_to_delete) + self._cpu_pipes[model_id] = copy.deepcopy(pipe.to('cpu')) + pipe.to(device) + if pipe.device.type == 'cuda': + self._store_gpu_pipe(pipe, model_id) + logger.debug(f'storing {model_id} on {pipe.device}') + + def clear_cache(self, device): + logger.debug(f'clear_cache pipelines from {device}') + with self._lock: + if device.type == 'cuda': + self._gpu_pipes[device.index] = [] + + def _store_gpu_pipe(self, pipe, model_id): + idx = pipe.device.index + # for now just clear all other pipelines + self._gpu_pipes[idx] = [(model_id, pipe)] def remove_pipeline(self, model_id): - self._pipes.pop(model_id) + self._cpu_pipes.pop(model_id) + + def get_pipeline(self, model_id, device=None): + with self._lock: + if device is None: + device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') + if device.type == 'cuda': + idx = device.index + gpu_pipes = self._gpu_pipes.get(idx, ()) + for (key, value) in gpu_pipes: + if key == model_id: + return value + for (key, pipe) in self._cpu_pipes.items(): + if key == model_id: + return pipe + + return None + + +def count_params(model): + total_size = sum(param.numel() for param in model.parameters()) + mul = 2 + if model.dtype == torch.float16: + mul = 2 + elif model.dtype == torch.float32: + mul = 4 + return total_size * mul + + +def get_size(obj): + return sys.getsizeof(obj) + + +def get_model_size(pipeline): + total_size = 0 + for name, component in pipeline.components.items(): + if isinstance(component, torch.nn.Module): + total_size += count_params(component) + elif hasattr(component, 'tokenizer'): + total_size += count_params(component.tokenizer) + else: + total_size += get_size(component) + return total_size / (1024 * 1024) + - def get_pipeline(self, model_id): - return self._pipes.get(model_id, None) +def awailable_ram(): + mem = psutil.virtual_memory() + available_ram = mem.available + return available_ram / (1024 * 1024) diff --git a/multigen/log.py b/multigen/log.py new file mode 100644 index 0000000..9d1f9a2 --- /dev/null +++ b/multigen/log.py @@ -0,0 +1,26 @@ +import logging +import threading + + +def thread_id_filter(record): + """Inject thread_id to log records""" + record.thread_id = threading.get_ident() + return record + +def setup_logger(path='log_file.log'): + logger = logging.getLogger() + logger.setLevel(logging.DEBUG) + fh = logging.FileHandler('log_file.log') + fh.setLevel(logging.DEBUG) + ch = logging.StreamHandler() + ch.setLevel(logging.INFO) + + ch.addFilter(thread_id_filter) + fh.addFilter(thread_id_filter) + formatter = logging.Formatter('%(asctime)s - %(thread)d - %(levelname)s - %(message)s') + fh.setFormatter(formatter) + ch.setFormatter(formatter) + + logger.addHandler(fh) + logger.addHandler(ch) + diff --git a/multigen/pipes.py b/multigen/pipes.py index 7940e72..fec7d37 100755 --- a/multigen/pipes.py +++ b/multigen/pipes.py @@ -67,7 +67,7 @@ class BasePipe: def __init__(self, model_id: str, sd_pipe_class: Optional[Type[DiffusionPipeline]] = None, pipe: Optional[DiffusionPipeline] = None, - model_type: Optional[ModelType] = None, lpw=False, **args): + model_type: Optional[ModelType] = None, device=None, lpw=False, **args): """ Constructor @@ -86,7 +86,8 @@ def __init__(self, model_id: str, **args: additional arguments passed to sd_pipe_class constructor """ - device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') + if device is None: + device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') self.pipe = pipe self._scheduler = None self._hypernets = [] @@ -125,8 +126,9 @@ def _get_model_type(self): raise RuntimeError("unsuported model type {self.pipe.__class__}") def _initialize_pipe(self, device): - if self.pipe.device != device: - self.pipe.to(device) + # sometimes text encoder is on a different device + # if self.pipe.device != device: + self.pipe.to(device) # self.pipe.enable_attention_slicing() # self.pipe.enable_vae_slicing() self.pipe.vae.enable_tiling() diff --git a/multigen/worker.py b/multigen/worker.py index ab65738..6ce5cb8 100755 --- a/multigen/worker.py +++ b/multigen/worker.py @@ -1,5 +1,8 @@ -import time import torch +import random +import time +import concurrent +from queue import Empty from .worker_base import ServiceThreadBase from .prompting import Cfgen @@ -8,78 +11,138 @@ class ServiceThread(ServiceThreadBase): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._gpu_jobs = dict() + def get_pipeline(self, pipe_name, model_id, cnet=None, xl=False): pipe_class = self.get_pipe_class(pipe_name) return self._get_pipeline(pipe_class, model_id, cnet=cnet, xl=xl) + def _get_device(self, model_id): + # choose random from resting gpus + # if there is no resting gpus choose + # one with our model_id otherwise choose random + devices = list(range(torch.cuda.device_count())) + self.logger.debug('awailable devices %s', devices) + if not devices: + self.logger.debug('returning cpu device') + return torch.device('cpu') + with self._lock: + self.logger.debug('locked gpu %s', self._gpu_jobs) + free_gpus = [x for x in devices if x not in self._gpu_jobs] + self.logger.debug('free gpus %s', free_gpus) + if free_gpus: + idx = random.choice(free_gpus) + else: + self.logger.debug('no free gpus') + gpus_with_model = self._loader.get_gpu(model_id) + if gpus_with_model: + idx = random.choice(gpus_with_model) + else: + idx = random.choice(devices) + self._gpu_jobs[idx] = model_id + self.logger.debug(f'locked device cuda:{idx} for {model_id}') + return torch.device('cuda', idx) + def _get_pipeline(self, pipe_class, model_id, cnet=None, xl=False): + device = self._get_device(model_id) if cnet is None: + # no controlnet if xl: cls = pipe_class._classxl else: cls = pipe_class._class - pipeline = self._loader.load_pipeline(cls, model_id, torch_dtype=torch.float16) - pipe = pipe_class(model_id, pipe=pipeline) + pipeline = self._loader.load_pipeline(cls, model_id, torch_dtype=torch.float16, device=device) + self.logger.debug(f'requested {cls} {model_id} on device {device}, got {pipeline.device}') + assert pipeline.device == device + pipe = pipe_class(model_id, pipe=pipeline, device=device) + assert pipeline.device == device else: - pipeline = self._loader.get_pipeline(model_id) + # out pipeline uses controlnet + pipeline = self._loader.get_pipeline(model_id, device=device) cnet_type = ModelType.SD + if xl: cnet_type = ModelType.SDXL if pipeline is None or 'controlnet' not in pipeline.components: - pipe = pipe_class(model_id, ctypes=[cnet], model_type=cnet_type) - self._loader.register_pipeline(pipe.pipe, model_id) + # reload + pipe = pipe_class(model_id, ctypes=[cnet], model_type=cnet_type, device=device) + self._loader.cache_pipeline(pipe.pipe, model_id) else: - pipe = pipe_class(model_id, pipe=pipeline, model_type=cnet_type) + pipe = pipe_class(model_id, pipe=pipeline, model_type=cnet_type, device=device) return pipe def run(self): + self.logger.debug('running thread') + num_of_workers = torch.cuda.device_count() + if num_of_workers == 0: + num_of_workers = 1 + executor = concurrent.futures.ThreadPoolExecutor(max_workers=num_of_workers) + while not self._stop: + try: + data = self.queue.get(block=False) + self.logger.debug('submitting job %s', data) + executor.submit(self.worker, data) + except Empty: + time.sleep(0.2) + + def worker(self, data): def _update(sess, job, gs): sess["images"].append(gs.last_img_name) if 'image_callback' in data: data['image_callback'](gs.last_img_name) job["count"] -= 1 - while not self._stop: - while self.queue: - # keep the job in the queue until complete - try: - with self._lock: - data = self.queue[-1] - sess = self.sessions[data["session_id"]] - self.logger.info("GENERATING: " + str(data)) - if 'start_callback' in data: - data['start_callback']() + device = None + # keep the job in the queue until complete + try: + session_id = data["session_id"] + sess = self.sessions[session_id] + sess['status'] ='running' + self.logger.info("GENERATING: " + str(data)) + if 'start_callback' in data: + data['start_callback']() - pipe_name = sess.get('pipe', 'Prompt2ImPipe') - model_id = str(self.cwd/self.config["model_dir"]/self.models['base'][sess["model"]]['id']) - loras = [str(self.cwd/self.config["model_dir"]/'Lora'/self.models['lora'][x]['id']) for x in sess.get("loras", [])] - data['loras'] = loras - is_xl = self.models['base'][sess["model"]]['xl'] - pipe = self.get_pipeline(pipe_name, model_id, cnet=data.get('cnet', None), xl=is_xl) - class_name = str(pipe.__class__) - self.logger.debug(f'got pipeline {class_name}') + pipe_name = sess.get('pipe', 'Prompt2ImPipe') + model_id = str(self.cwd/self.config["model_dir"]/self.models['base'][sess["model"]]['id']) + loras = [str(self.cwd/self.config["model_dir"]/'Lora'/self.models['lora'][x]['id']) for x in sess.get("loras", [])] + data['loras'] = loras + is_xl = self.models['base'][sess["model"]]['xl'] + pipe = self.get_pipeline(pipe_name, model_id, cnet=data.get('cnet', None), xl=is_xl) + device = pipe.pipe.device + self.logger.debug(f'running job on {device}') + if device.type == 'cuda': + self._gpu_jobs[device.index] = model_id + class_name = str(pipe.__class__) + self.logger.debug(f'got pipeline {class_name}') - images = data['images'] - if 'MaskedIm2ImPipe' in class_name: - pipe.setup(**data, original_image=str(images[0]), - image_painted=str(images[1])) - elif any([x in class_name for x in ('Im2ImPipe', 'Cond2ImPipe')]): - pipe.setup(**data, fimage=str(images[0])) - else: - pipe.setup(**data) - # TODO: add negative prompt to parameters - nprompt = "jpeg artifacts, blur, distortion, watermark, signature, extra fingers, fewer fingers, lowres, nude, bad hands, duplicate heads, bad anatomy, bad crop" - seeds = data.get('seeds', None) - gs = GenSession(self.get_image_pathname(data["session_id"], None), - pipe, Cfgen(data["prompt"], nprompt, seeds=seeds)) - gs.gen_sess(add_count = data["count"], - callback = lambda: _update(sess, data, gs)) - if 'finish_callback' in data: - data['finish_callback']() - except (RuntimeError, TypeError, NotImplementedError) as e: - self.logger.error("error in generation", exc_info=e) - if 'finish_callback' in data: - data['finish_callback']("Can't generate image due to error") - finally: - with self._lock: - self.queue.pop() - time.sleep(0.2) + images = data['images'] + if 'MaskedIm2ImPipe' in class_name: + pipe.setup(**data, original_image=str(images[0]), + image_painted=str(images[1])) + elif any([x in class_name for x in ('Im2ImPipe', 'Cond2ImPipe')]): + pipe.setup(**data, fimage=str(images[0])) + else: + pipe.setup(**data) + # TODO: add negative prompt to parameters + nprompt = "jpeg artifacts, blur, distortion, watermark, signature, extra fingers, fewer fingers, lowres, nude, bad hands, duplicate heads, bad anatomy, bad crop" + seeds = data.get('seeds', None) + gs = GenSession(self.get_image_pathname(data["session_id"], None), + pipe, Cfgen(data["prompt"], nprompt, seeds=seeds)) + gs.gen_sess(add_count = data["count"], + callback = lambda: _update(sess, data, gs)) + if 'finish_callback' in data: + data['finish_callback']() + except (RuntimeError, TypeError, NotImplementedError) as e: + self.logger.error("error in generation", exc_info=e) + if 'finish_callback' in data: + data['finish_callback']("Can't generate image due to error") + except Exception as e: + self.logger.error("unexpected error in generation", exc_info=e) + raise e + finally: + self.logger.debug('unlock device %s', device) + if device is not None and device.type == 'cuda': + with self._lock: + del self._gpu_jobs[device.index] diff --git a/multigen/worker_base.py b/multigen/worker_base.py index 7cc1298..31b6751 100755 --- a/multigen/worker_base.py +++ b/multigen/worker_base.py @@ -2,7 +2,7 @@ from datetime import datetime from typing import Type import threading -from collections import deque +from queue import Queue, Full import random import yaml from pathlib import Path @@ -18,6 +18,7 @@ class ServiceThreadBase(threading.Thread): def __init__(self, cfg_file): super().__init__(name='imgen', daemon=False) cfg_file = Path(cfg_file) + self.queue_num = 0 self.cwd = cfg_file.parent with open(cfg_file, "r") as f: self.config = yaml.safe_load(f) @@ -30,10 +31,10 @@ def __init__(self, cfg_file): logging.basicConfig(filename=logname, level=logging.INFO) self.logger = logging.getLogger(__name__) self.sessions = {} - self.queue = deque() self.qlimit = 5 + self.queue = Queue(self.qlimit) self.max_img_cnt = 20 - self._lock = threading.Lock() + self._lock = threading.RLock() self._stop = False self._loader = Loader() self._pipe_name_to_pipe = dict() @@ -81,7 +82,7 @@ def open_session(self, **args): id = str(random.randint(0, 1024*1024*1024*4-1)) self.sessions[id] = {**args} self.sessions[id]["images"] = [] - self.logger.info("OPENING session %s", id) + self.logger.info("OPENING session %s, model %s", id, args['model']) return { "session_id": id } def close_session(self, session_id): @@ -96,11 +97,9 @@ def queue_gen(self, **args): with self._lock: if args["session_id"] not in self.sessions: return { "error": "Session is not open" } - if len(self.queue) >= self.qlimit: - return { "error": "Server is busy" } - for q in self.queue: - if q["session_id"] == args["session_id"]: - return { "error": "The job for this session already exists" } + # for q in self.queue: + # if q["session_id"] == args["session_id"]: + # return { "error": "The job for this session already exists" } a = {**args} a["count"] = int(a["count"]) if a["count"] <= 0: @@ -109,8 +108,14 @@ def queue_gen(self, **args): if a["count"] > self.max_img_cnt: a["count"] = self.max_img_cnt r["warning"] = f"maximum image count exceeded {self.max_img_cnt}" - self.queue.appendleft(a) - r["queue_number"] = len(self.queue)-1 + try: + self.queue.put(a) + except Full: + return { "error": "Server is busy" } + + r["queue_number"] = self.queue_num + self.queue_num += 1 + self.logger.info(f'queued a job {a}') return r def get_image_count(self, session_id): @@ -129,16 +134,7 @@ def get_session_info(self, session_id): result = {} result["available_images"] = len(sess["images"]) result["next_job"] = "None" - result["status"] = "open" - for i in range(len(self.queue)): - q = self.queue[i] - if q["session_id"] == session_id: - result["status"] = "running" if i == 0 else "queued" - result["next_job"] = { - "queue_number": i, - "image_count": q["count"] - } - break + result["status"] = sess.get('status', 'open') return result def get_image_pathname(self, session_id, img_idx): diff --git a/requirements.txt b/requirements.txt index 98928bc..0b7c1fb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ opencv_python>=4.6.0.66 Pillow torch transformers +psutil diff --git a/tests/config.yaml b/tests/config.yaml new file mode 100644 index 0000000..650c0cc --- /dev/null +++ b/tests/config.yaml @@ -0,0 +1,3 @@ +model_list: models.yaml +model_dir: ./models-sd/ +logging_folder: ./logs/ diff --git a/tests/models-sd/SDXL/tiny-sdxl/model_index.json b/tests/models-sd/SDXL/tiny-sdxl/model_index.json new file mode 100644 index 0000000..eb822f5 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/model_index.json @@ -0,0 +1,41 @@ +{ + "_class_name": "StableDiffusionXLPipeline", + "_diffusers_version": "0.28.0.dev0", + "feature_extractor": [ + null, + null + ], + "force_zeros_for_empty_prompt": true, + "image_encoder": [ + null, + null + ], + "scheduler": [ + "diffusers", + "EulerDiscreteScheduler" + ], + "text_encoder": [ + "transformers", + "CLIPTextModel" + ], + "text_encoder_2": [ + "transformers", + "CLIPTextModelWithProjection" + ], + "tokenizer": [ + "transformers", + "CLIPTokenizer" + ], + "tokenizer_2": [ + "transformers", + "CLIPTokenizer" + ], + "unet": [ + "diffusers", + "UNet2DConditionModel" + ], + "vae": [ + "diffusers", + "AutoencoderKL" + ] +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/scheduler/scheduler_config.json b/tests/models-sd/SDXL/tiny-sdxl/scheduler/scheduler_config.json new file mode 100644 index 0000000..121eb53 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/scheduler/scheduler_config.json @@ -0,0 +1,18 @@ +{ + "_class_name": "EulerDiscreteScheduler", + "_diffusers_version": "0.28.0.dev0", + "beta_end": 0.012, + "beta_schedule": "scaled_linear", + "beta_start": 0.00085, + "interpolation_type": "linear", + "num_train_timesteps": 1000, + "prediction_type": "epsilon", + "rescale_betas_zero_snr": false, + "sigma_max": null, + "sigma_min": null, + "steps_offset": 1, + "timestep_spacing": "leading", + "timestep_type": "discrete", + "trained_betas": null, + "use_karras_sigmas": false +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/text_encoder/config.json b/tests/models-sd/SDXL/tiny-sdxl/text_encoder/config.json new file mode 100644 index 0000000..42e6143 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/text_encoder/config.json @@ -0,0 +1,24 @@ +{ + "_name_or_path": "/home/imgen/.cache/huggingface/hub/models--hf-internal-testing--tiny-stable-diffusion-xl-pipe/snapshots/fa06b5c3d6d45fabd978486616c6dae068519e85/text_encoder", + "architectures": [ + "CLIPTextModel" + ], + "attention_dropout": 0.0, + "bos_token_id": 0, + "eos_token_id": 2, + "hidden_act": "gelu", + "hidden_size": 32, + "initializer_factor": 1.0, + "initializer_range": 0.02, + "intermediate_size": 37, + "layer_norm_eps": 1e-05, + "max_position_embeddings": 77, + "model_type": "clip_text_model", + "num_attention_heads": 4, + "num_hidden_layers": 5, + "pad_token_id": 1, + "projection_dim": 32, + "torch_dtype": "float16", + "transformers_version": "4.37.1", + "vocab_size": 1000 +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/text_encoder/model.safetensors b/tests/models-sd/SDXL/tiny-sdxl/text_encoder/model.safetensors new file mode 100644 index 0000000..52142b7 Binary files /dev/null and b/tests/models-sd/SDXL/tiny-sdxl/text_encoder/model.safetensors differ diff --git a/tests/models-sd/SDXL/tiny-sdxl/text_encoder_2/config.json b/tests/models-sd/SDXL/tiny-sdxl/text_encoder_2/config.json new file mode 100644 index 0000000..06b5804 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/text_encoder_2/config.json @@ -0,0 +1,24 @@ +{ + "_name_or_path": "/home/imgen/.cache/huggingface/hub/models--hf-internal-testing--tiny-stable-diffusion-xl-pipe/snapshots/fa06b5c3d6d45fabd978486616c6dae068519e85/text_encoder_2", + "architectures": [ + "CLIPTextModelWithProjection" + ], + "attention_dropout": 0.0, + "bos_token_id": 0, + "eos_token_id": 2, + "hidden_act": "gelu", + "hidden_size": 32, + "initializer_factor": 1.0, + "initializer_range": 0.02, + "intermediate_size": 37, + "layer_norm_eps": 1e-05, + "max_position_embeddings": 77, + "model_type": "clip_text_model", + "num_attention_heads": 4, + "num_hidden_layers": 5, + "pad_token_id": 1, + "projection_dim": 32, + "torch_dtype": "float16", + "transformers_version": "4.37.1", + "vocab_size": 1000 +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/text_encoder_2/model.safetensors b/tests/models-sd/SDXL/tiny-sdxl/text_encoder_2/model.safetensors new file mode 100644 index 0000000..2aff568 Binary files /dev/null and b/tests/models-sd/SDXL/tiny-sdxl/text_encoder_2/model.safetensors differ diff --git a/tests/models-sd/SDXL/tiny-sdxl/tokenizer/merges.txt b/tests/models-sd/SDXL/tiny-sdxl/tokenizer/merges.txt new file mode 100644 index 0000000..e9193d6 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/tokenizer/merges.txt @@ -0,0 +1,647 @@ +#version: 0.2 +Ġ t +Ġt h +Ġ a +Ġth e +i n +Ġ o +Ġ , +Ġ s +e d +Ġ w +e r +Ġ . +Ġ i +r e +Ġ c +n d +Ġ f +Ġ b +a t +Ġo f +e r +e n +a r +o r +i t +Ġ p +Ġ h +Ġa nd +o n +in g +a n +r o +Ġ m +Ġ d +e s +Ġi n +o n +Ġt o +o u +i s +Ġ a +i c +Ġ T +a l +Ġ l +Ġ = +Ġ re +Ġ " +e s +Ġ S +a s +a l +i l +e l +i on +Ġ A +Ġ C +Ġ 1 +Ġ Ċ +u r +ĠT h +Ġ n +a s +Ġ @ +e c +o m +a c +Ġ e +Ġw as +Ġ M +o r +a n +a m +e n +o l +Ġ in +Ġ g +Ġ ' +Ġ B +l y +a t +i v +t s +ĠTh e +u s +- @ +Ġ@ -@ +i s +Ġ I +Ġw h +i g +Ġ H +Ġs t +o s +u n +t h +Ġ P +Ġw it +Ġth at +i r +Ġa s +e m +Ġo n +r a +Ġf or +Ġ R +e t +o w +Ġ 2 +i d +Ġ D +l e +Ġwit h +l a +en t +i m +Ġ F +e a +i on +Ġb y +Ġ ) +Ġ ( +Ġa l +Ġc on +en t +Ġ W +Ġi s +er e +Ġ G +Ġ N +Ġ L +Ġh a +er s +r i +t h +t ed +u c +Ġ J +Ġ1 9 +e v +u l +Ġ v +c e +at ion +ro m +Ġb e +Ġ E +i n +Ġth e +Ġf rom +Ġ O +t er +Ġp ro +Ġa r +a d +Ġc om +i c +a g +Ġh is +Ġs h +Ġa t +o v +i es +o o +p p +s t +c h +Ġ r +Ġ2 0 +a y +i f +Ġw ere +Ġc h +u t +s t +u t +d s +o p +u m +Ġi t +o c +t er +l e +ig h +u d +Ġe x +ion s +at e +it y +at ed +Ġ un +e p +q u +Ġn o +Ġ K +iv e +is t +Ġo n +am e +ou n +i r +a b +Ġ â +in g +Ġh e +l d +u g +ic h +Ġa n +e d +Ġ k +Ġâ Ģ +Ġha d +v e +a in +Ġs e +t ion +or e +re s +Ġwh ich +ĠI n +o d +th er +a k +Ġs p +a r +Ġ y +ĠC h +on g +Ġa c +es t +Ġ U +a p +f f +al ly +r it +ĠS t +u b +g e +b er +e t +Ġb e +e ar +Ġre c +er s +Ġf ir +o t +Ġar e +Ġa n +c h +o g +i a +es t +in e +il l +an d +e l +ar y +e w +i d +Ġf or +Ġ ; +Ġcom p +Ġ V +Ġin c +t r +Ġ20 0 +Ġthe ir +u s +Ġb ut +r an +ic al +Ġfir st +Ġd e +Ġin t +Ġ ro +s o +ĠâĢ ĵ +Ġno t +d ing +f ter +ur e +Ġp ar +Ġ : +i an +Ġt w +ou ld +Ġal so +Ġi ts +Ġw or +u m +Ġo r +os t +0 0 +ou r +ar d +Ġre s +m p +u e +Ġa b +is h +Ġcon t +Ġa d +ow n +al l +ou g +Ġh er +as t +Ġ en +om e +al l +d ed +o w +Ġha ve +Ġ us +ea r +ac k +d uc +i al +s s +en ts +a in +t ing +Ġon e +es s +Ġh as +igh t +a v +Ġe v +ou t +a y +en ce +Ġbe en +e w +Ġtw o +Ġc l +d er +im e +k s +es s +is h +. @ +Ġ@ .@ +Ġp la +Ġp l +Ġo r +u p +m ent +ur ing +ol l +ĠI n +Ġth is +Ġb ec +Ġcom m +Ġd is +at er +ag e +Ġa pp +ou s +e y +i l +p er +ĠA l +ion al +l ud +el y +t t +il e +i z +Ġ j +Ġwh o +Ġa g +i b +Ġthe y +f or +Ġo v +at h +e g +Ġs c +i p +Ġ20 1 +Ġ 3 +Ġp er +or y +Ġd es +id e +Ġs er +s e +ĠH e +la nd +at ions +r ic +i t +re s +er ed +Ġp re +ĠS h +an ce +or t +an t +, @ +Ġ@ ,@ +el l +Ġ Y +n ed +el l +it e +Ġinc lud +Ġre p +Ġa fter +Ġs uc +re e +an y +i m +or t +Ġ1 8 +Ġs u +ad e +ou r +ĠU n +ĠI t +i k +ĠM ar +em ber +Ġ 1 +e en +a nd +Ġs ec +ic e +Ġt ime +ĠA n +Ġint o +Ġf in +Ġo ther +Ġa tt +il l +re n +ac h +as s +er al +es e +s h +al s +it ion +oug h +l es +am p +Ġw ould +Ġm ore +ro ug +ri b +er y +ac e +Ġ A +Ġpla y +it ed +k ed +is t +i ed +Ġ 2 +as ed +ing s +an g +a m +i p +Ġb o +ab le +t y +Ġch ar +Ġc ent +et w +at es +ro p +Ġ I +u nd +ĠA m +c es +o in +Ġin ter +u p +c t +on e +Ġt ra +an t +ec t +Ġal l +e f +Ġcon s +ub l +n ing +an s +Ġf e +us t +Ġ 0 +Ġre m +as e +on g +Ġwh en +e b +ĠW h +Ġe ar +ev er +Ġov er +Ġk n +a us +Ġp os +a d +er m +Ġsh e +Ġ ra +Ġd uring +as on +v i +Ġex p +Ġl ea +Ġ el +Ġ 4 +Ġon ly +o nd +Ġd ec +Ġac c +Ġo ff +is s +Ġf l +ĠE n +o t +en s +os e +ak e +o m +Ġs ev +ac h +etw een +er n +Ġ 3 +Ġp r +Ġg ro +r uc +Ġd i +Ġ19 9 +ĠA r +Ġg ame +Ġh im +oo k +Ġ up +Ġab out +Ġre l +for m +Ġth ree +at t +ĠC om +Ġs a +ear s +Ġ 5 +r y +Ġi mp +Ġm ost +f er +Ġp res +Ġf il +Ġb etween +Ġbe g +p h +or s +Ġth an +Ġrec or +o b +er ic +at ing +Ġth roug +k ing +Ġo ut +Ġn um +oo d +oll ow +ac t +u il +Ġc re +ol og +at ional +Ġpro duc +Ġwh ile +Ġl ater +Ġw rit +e x +Ġst ar +Ġsp ec +e e +ish ed +Ġre g +is ion +ou th +Ġre le +Ġa ss +Ġse ason +Ġm ade +il y +r u +o y +t ur +t e +Ġ qu +Ġm ov +ur y +ĠAm eric +em ent +c c +ou nd +Ġl ar +Ġfor m +ec t +Ġde f +Ġm us +ĠP ar +Ġm e +Ġs ub +w ay +o p +o h +el d +i e +em p +am es +er n +Ġn or +iv ed +ev el +Ġsuc h +ar ds +Ġin d +ik e +Ġg en +er t +Ġy ear +Ġus ed +Ġn ew +Ġ 5 +Ġal b +s p +y p +Ġwit h +Ġwh ere +ic s +ĠTh is +Ġthe m +w n diff --git a/tests/models-sd/SDXL/tiny-sdxl/tokenizer/special_tokens_map.json b/tests/models-sd/SDXL/tiny-sdxl/tokenizer/special_tokens_map.json new file mode 100644 index 0000000..2c2130b --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/tokenizer/special_tokens_map.json @@ -0,0 +1,24 @@ +{ + "bos_token": { + "content": "<|startoftext|>", + "lstrip": false, + "normalized": true, + "rstrip": false, + "single_word": false + }, + "eos_token": { + "content": "<|endoftext|>", + "lstrip": false, + "normalized": true, + "rstrip": false, + "single_word": false + }, + "pad_token": "<|endoftext|>", + "unk_token": { + "content": "<|endoftext|>", + "lstrip": false, + "normalized": true, + "rstrip": false, + "single_word": false + } +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/tokenizer/tokenizer_config.json b/tests/models-sd/SDXL/tiny-sdxl/tokenizer/tokenizer_config.json new file mode 100644 index 0000000..7eae593 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/tokenizer/tokenizer_config.json @@ -0,0 +1,30 @@ +{ + "add_prefix_space": false, + "added_tokens_decoder": { + "0": { + "content": "<|startoftext|>", + "lstrip": false, + "normalized": true, + "rstrip": false, + "single_word": false, + "special": true + }, + "1": { + "content": "<|endoftext|>", + "lstrip": false, + "normalized": true, + "rstrip": false, + "single_word": false, + "special": true + } + }, + "bos_token": "<|startoftext|>", + "clean_up_tokenization_spaces": true, + "do_lower_case": true, + "eos_token": "<|endoftext|>", + "errors": "replace", + "model_max_length": 77, + "pad_token": "<|endoftext|>", + "tokenizer_class": "CLIPTokenizer", + "unk_token": "<|endoftext|>" +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/tokenizer/vocab.json b/tests/models-sd/SDXL/tiny-sdxl/tokenizer/vocab.json new file mode 100644 index 0000000..609c08e --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/tokenizer/vocab.json @@ -0,0 +1,1002 @@ +{ + "!": 2, + "!": 345, + "\"": 3, + "\"": 344, + "#": 4, + "#": 325, + "$": 5, + "$": 348, + "%": 6, + "%": 351, + "&": 7, + "&": 352, + "'": 8, + "'": 296, + "(": 9, + "(": 318, + ")": 10, + ")": 330, + "*": 11, + "*": 327, + "+": 12, + "+": 341, + ",": 13, + ",": 279, + ",@": 754, + "-": 14, + "-": 276, + "-@": 439, + ".": 15, + ".": 253, + ".@": 695, + "/": 16, + "/": 350, + "0": 17, + "00": 647, + "0": 216, + "1": 18, + "1": 222, + "2": 19, + "2": 231, + "3": 20, + "3": 243, + "4": 21, + "4": 233, + "5": 22, + "5": 240, + "6": 23, + "6": 226, + "7": 24, + "7": 215, + "8": 25, + "8": 236, + "9": 26, + "9": 242, + ":": 27, + ":": 353, + ";": 28, + ";": 317, + "<": 29, + "<": 340, + "<|endoftext|>": 1, + "<|startoftext|>": 0, + "=": 30, + "=": 342, + ">": 31, + ">": 300, + "?": 32, + "?": 346, + "@": 33, + "@": 320, + "A": 34, + "A": 227, + "B": 35, + "B": 258, + "C": 36, + "C": 239, + "D": 37, + "D": 255, + "E": 38, + "E": 246, + "F": 39, + "F": 213, + "G": 40, + "G": 283, + "H": 41, + "H": 219, + "I": 42, + "I": 237, + "J": 43, + "J": 251, + "K": 44, + "K": 254, + "L": 45, + "L": 218, + "M": 46, + "M": 234, + "N": 47, + "N": 238, + "O": 48, + "O": 265, + "P": 49, + "P": 245, + "Q": 50, + "Q": 309, + "R": 51, + "R": 264, + "S": 52, + "S": 230, + "T": 53, + "T": 235, + "U": 54, + "U": 268, + "V": 55, + "V": 248, + "W": 56, + "W": 274, + "X": 57, + "X": 263, + "Y": 58, + "Y": 310, + "Z": 59, + "Z": 207, + "[": 60, + "[": 270, + "\\": 61, + "\\": 338, + "]": 62, + "]": 289, + "^": 63, + "^": 331, + "_": 64, + "_": 334, + "`": 65, + "`": 347, + "a": 66, + "a": 197, + "ab": 555, + "able": 820, + "ac": 420, + "ace": 806, + "ach": 791, + "ach": 885, + "ack": 670, + "act": 929, + "ad": 508, + "ad": 860, + "ade": 771, + "ag": 511, + "age": 710, + "ain": 568, + "ain": 675, + "ak": 577, + "ake": 882, + "al": 397, + "al": 405, + "all": 664, + "all": 658, + "ally": 588, + "als": 796, + "am": 426, + "am": 817, + "ame": 552, + "ames": 976, + "amp": 800, + "an": 384, + "an": 425, + "ance": 751, + "and": 609, + "and": 780, + "ang": 816, + "ans": 844, + "ant": 837, + "ant": 753, + "any": 766, + "ap": 586, + "ar": 376, + "ar": 579, + "ard": 649, + "ards": 982, + "ary": 611, + "as": 416, + "as": 404, + "ase": 849, + "ased": 814, + "ason": 865, + "ass": 792, + "ast": 661, + "at": 372, + "at": 434, + "ate": 541, + "ated": 543, + "ater": 709, + "ates": 825, + "ath": 730, + "ating": 922, + "ation": 497, + "ational": 933, + "ations": 744, + "att": 903, + "aus": 858, + "av": 681, + "ay": 684, + "ay": 523, + "b": 67, + "b": 212, + "ber": 593, + "c": 68, + "c": 224, + "cc": 960, + "ce": 496, + "ces": 830, + "ch": 520, + "ch": 603, + "ct": 834, + "d": 69, + "d": 196, + "ded": 665, + "der": 690, + "ding": 633, + "ds": 530, + "duc": 671, + "e": 70, + "e": 195, + "ea": 471, + "ear": 596, + "ear": 669, + "ears": 906, + "eb": 852, + "ec": 418, + "ect": 838, + "ect": 964, + "ed": 563, + "ed": 362, + "ee": 941, + "een": 779, + "ef": 840, + "eg": 731, + "el": 407, + "el": 610, + "eld": 973, + "ell": 759, + "ell": 756, + "ely": 719, + "em": 455, + "ember": 777, + "ement": 959, + "emp": 975, + "en": 375, + "en": 427, + "ence": 685, + "ens": 880, + "ent": 478, + "ent": 468, + "ents": 674, + "ep": 545, + "er": 364, + "er": 374, + "eral": 793, + "ere": 481, + "ered": 748, + "eric": 921, + "erm": 861, + "ern": 887, + "ern": 977, + "ers": 598, + "ers": 486, + "ert": 986, + "ery": 805, + "es": 402, + "es": 388, + "ese": 794, + "ess": 678, + "ess": 693, + "est": 606, + "est": 584, + "et": 460, + "et": 594, + "etw": 824, + "etween": 886, + "ev": 493, + "evel": 980, + "ever": 855, + "ew": 687, + "ew": 612, + "ex": 938, + "ey": 713, + "f": 71, + "f": 209, + "fer": 911, + "ff": 587, + "for": 728, + "form": 901, + "fter": 634, + "g": 72, + "g": 214, + "ge": 592, + "h": 73, + "h": 203, + "i": 74, + "i": 205, + "ia": 605, + "ial": 672, + "ian": 638, + "ib": 726, + "ic": 395, + "ic": 510, + "ical": 625, + "ice": 782, + "ich": 561, + "ics": 996, + "id": 463, + "id": 613, + "ide": 739, + "ie": 974, + "ied": 812, + "ies": 516, + "if": 524, + "ig": 444, + "igh": 537, + "ight": 680, + "ik": 775, + "ike": 984, + "il": 406, + "il": 714, + "ile": 721, + "ill": 608, + "ill": 789, + "ily": 950, + "im": 469, + "im": 767, + "ime": 691, + "in": 358, + "in": 501, + "ine": 607, + "ing": 557, + "ing": 383, + "ings": 815, + "ion": 472, + "ion": 408, + "ional": 717, + "ions": 540, + "ip": 733, + "ip": 818, + "ir": 453, + "ir": 554, + "is": 393, + "is": 441, + "ish": 694, + "ish": 654, + "ished": 942, + "ision": 944, + "iss": 876, + "ist": 550, + "ist": 811, + "it": 378, + "it": 746, + "ite": 760, + "ited": 809, + "ition": 797, + "ity": 542, + "iv": 435, + "ive": 549, + "ived": 979, + "iz": 722, + "j": 75, + "j": 288, + "k": 76, + "k": 210, + "ked": 810, + "king": 924, + "ks": 692, + "l": 77, + "l": 201, + "la": 467, + "land": 743, + "ld": 559, + "le": 536, + "le": 465, + "les": 799, + "lud": 718, + "ly": 433, + "m": 78, + "m": 202, + "ment": 701, + "mp": 651, + "n": 79, + "n": 199, + "nd": 369, + "ned": 758, + "ning": 843, + "o": 80, + "o": 198, + "ob": 920, + "oc": 534, + "od": 575, + "og": 604, + "oh": 972, + "oin": 831, + "ol": 428, + "oll": 703, + "ollow": 928, + "olog": 932, + "om": 419, + "om": 883, + "ome": 663, + "on": 382, + "on": 390, + "ond": 872, + "one": 835, + "ong": 850, + "ong": 582, + "oo": 517, + "ood": 927, + "ook": 897, + "op": 531, + "op": 971, + "or": 377, + "or": 424, + "ore": 571, + "ors": 917, + "ort": 768, + "ort": 752, + "ory": 737, + "os": 447, + "ose": 881, + "ost": 646, + "ot": 600, + "ot": 879, + "ou": 392, + "oug": 659, + "ough": 798, + "ould": 640, + "oun": 553, + "ound": 961, + "our": 648, + "our": 772, + "ous": 712, + "out": 683, + "outh": 945, + "ov": 515, + "ow": 461, + "ow": 666, + "own": 657, + "oy": 952, + "p": 81, + "p": 217, + "per": 715, + "ph": 916, + "pp": 518, + "q": 82, + "q": 280, + "qu": 546, + "r": 83, + "r": 204, + "ra": 457, + "ran": 624, + "re": 367, + "ree": 765, + "ren": 790, + "res": 572, + "res": 747, + "ri": 487, + "rib": 804, + "ric": 745, + "rit": 589, + "ro": 385, + "rom": 498, + "rop": 826, + "roug": 803, + "ru": 951, + "ruc": 891, + "ry": 908, + "s": 84, + "s": 206, + "se": 741, + "sh": 795, + "so": 630, + "sp": 992, + "ss": 673, + "st": 519, + "st": 528, + "t": 85, + "t": 208, + "te": 954, + "ted": 489, + "ter": 535, + "ter": 505, + "th": 449, + "th": 488, + "ther": 576, + "ting": 676, + "tion": 570, + "tr": 619, + "ts": 436, + "tt": 720, + "tur": 953, + "ty": 821, + "u": 86, + "u": 229, + "ub": 591, + "ubl": 842, + "uc": 490, + "ud": 538, + "ue": 652, + "ug": 560, + "uil": 930, + "ul": 494, + "um": 532, + "um": 644, + "un": 448, + "und": 828, + "up": 833, + "up": 700, + "ur": 413, + "ure": 635, + "uring": 702, + "ury": 957, + "us": 438, + "us": 622, + "ust": 846, + "ut": 529, + "ut": 527, + "v": 87, + "v": 232, + "ve": 567, + "vi": 866, + "w": 88, + "w": 250, + "way": 970, + "wn": 999, + "x": 89, + "x": 269, + "y": 90, + "y": 211, + "yp": 993, + "z": 91, + "z": 228, + "|": 92, + "|": 304, + "}": 93, + "}": 336, + "~": 94, + "~": 343, + "¡": 95, + "¡": 220, + "¢": 96, + "¢": 306, + "£": 97, + "£": 323, + "¤": 98, + "¤": 292, + "¥": 99, + "¥": 339, + "¦": 100, + "¦": 303, + "§": 101, + "§": 275, + "¨": 102, + "¨": 282, + "©": 103, + "©": 259, + "ª": 104, + "ª": 286, + "«": 105, + "«": 266, + "¬": 106, + "¬": 319, + "®": 107, + "®": 329, + "¯": 108, + "¯": 287, + "°": 109, + "°": 298, + "±": 110, + "±": 200, + "²": 111, + "²": 284, + "³": 112, + "³": 272, + "´": 113, + "´": 307, + "µ": 114, + "µ": 261, + "¶": 115, + "¶": 301, + "·": 116, + "·": 326, + "¸": 117, + "¸": 257, + "¹": 118, + "¹": 241, + "º": 119, + "º": 260, + "»": 120, + "»": 247, + "¼": 121, + "¼": 305, + "½": 122, + "½": 294, + "¾": 123, + "¾": 316, + "¿": 124, + "¿": 271, + "Â": 125, + "Ã": 126, + "Ä": 127, + "Å": 128, + "Æ": 129, + "Ç": 130, + "È": 131, + "É": 132, + "Ê": 133, + "Ë": 134, + "Ì": 135, + "Í": 136, + "Î": 137, + "Ï": 138, + "Ð": 139, + "Ñ": 140, + "Ö": 141, + "×": 142, + "Ø": 143, + "Ù": 144, + "Ü": 145, + "à": 146, + "á": 147, + "â": 148, + "ã": 149, + "ä": 150, + "å": 151, + "æ": 152, + "ç": 153, + "è": 154, + "é": 155, + "ë": 156, + "ì": 157, + "ï": 158, + "Ċ": 159, + "Ċ": 349, + "Ġ": 160, + "Ġ\"": 401, + "Ġ'": 431, + "Ġ(": 475, + "Ġ)": 474, + "Ġ,": 360, + "Ġ.": 365, + "Ġ0": 847, + "Ġ1": 411, + "Ġ18": 769, + "Ġ19": 492, + "Ġ199": 893, + "Ġ1": 778, + "Ġ2": 462, + "Ġ20": 522, + "Ġ200": 620, + "Ġ201": 734, + "Ġ2": 813, + "Ġ3": 735, + "Ġ3": 888, + "Ġ4": 870, + "Ġ5": 907, + "Ġ5": 990, + "Ġ:": 637, + "Ġ;": 615, + "Ġ": 333, + "Ġ=": 399, + "Ġ@": 417, + "Ġ@,@": 755, + "Ġ@-@": 440, + "Ġ@.@": 696, + "ĠA": 409, + "ĠA": 807, + "ĠAl": 716, + "ĠAm": 829, + "ĠAmeric": 958, + "ĠAn": 784, + "ĠAr": 894, + "ĠB": 432, + "ĠC": 410, + "ĠCh": 581, + "ĠCom": 904, + "ĠD": 464, + "ĠE": 500, + "ĠEn": 878, + "ĠF": 470, + "ĠG": 482, + "ĠH": 445, + "ĠHe": 742, + "ĠI": 442, + "ĠI": 827, + "ĠIn": 704, + "ĠIn": 574, + "ĠIt": 774, + "ĠJ": 491, + "ĠK": 548, + "ĠL": 484, + "ĠM": 423, + "ĠMar": 776, + "ĠN": 483, + "ĠO": 504, + "ĠP": 450, + "ĠPar": 967, + "ĠR": 459, + "ĠS": 403, + "ĠSh": 750, + "ĠSt": 590, + "ĠT": 396, + "ĠTh": 414, + "ĠThe": 437, + "ĠThis": 997, + "ĠU": 585, + "ĠUn": 773, + "ĠV": 617, + "ĠW": 479, + "ĠWh": 853, + "ĠY": 757, + "Ġa": 356, + "Ġa": 394, + "Ġab": 653, + "Ġabout": 899, + "Ġac": 583, + "Ġacc": 874, + "Ġad": 656, + "Ġafter": 763, + "Ġag": 725, + "Ġal": 476, + "Ġalb": 991, + "Ġall": 839, + "Ġalso": 641, + "Ġan": 602, + "Ġan": 562, + "Ġand": 381, + "Ġapp": 711, + "Ġar": 507, + "Ġare": 601, + "Ġas": 454, + "Ġass": 947, + "Ġat": 514, + "Ġatt": 788, + "Ġb": 371, + "Ġbe": 499, + "Ġbe": 595, + "Ġbec": 706, + "Ġbeen": 686, + "Ġbeg": 915, + "Ġbetween": 914, + "Ġbo": 819, + "Ġbut": 623, + "Ġby": 473, + "Ġc": 368, + "Ġcent": 823, + "Ġch": 526, + "Ġchar": 822, + "Ġcl": 689, + "Ġcom": 509, + "Ġcomm": 707, + "Ġcomp": 616, + "Ġcon": 477, + "Ġcons": 841, + "Ġcont": 655, + "Ġcre": 931, + "Ġd": 387, + "Ġde": 627, + "Ġdec": 873, + "Ġdef": 965, + "Ġdes": 738, + "Ġdi": 892, + "Ġdis": 708, + "Ġduring": 864, + "Ġe": 421, + "Ġear": 854, + "Ġel": 869, + "Ġen": 662, + "Ġev": 682, + "Ġex": 539, + "Ġexp": 867, + "Ġf": 370, + "Ġfe": 845, + "Ġfil": 913, + "Ġfin": 786, + "Ġfir": 599, + "Ġfirst": 626, + "Ġfl": 877, + "Ġfor": 614, + "Ġfor": 458, + "Ġform": 963, + "Ġfrom": 503, + "Ġg": 430, + "Ġgame": 895, + "Ġgen": 985, + "Ġgro": 890, + "Ġh": 380, + "Ġha": 485, + "Ġhad": 566, + "Ġhas": 679, + "Ġhave": 667, + "Ġhe": 558, + "Ġher": 660, + "Ġhim": 896, + "Ġhis": 512, + "Ġi": 366, + "Ġimp": 909, + "Ġin": 429, + "Ġin": 389, + "Ġinc": 618, + "Ġinclud": 761, + "Ġind": 983, + "Ġint": 628, + "Ġinter": 832, + "Ġinto": 785, + "Ġis": 480, + "Ġit": 533, + "Ġits": 642, + "Ġj": 723, + "Ġk": 564, + "Ġkn": 857, + "Ġl": 398, + "Ġlar": 962, + "Ġlater": 936, + "Ġlea": 868, + "Ġm": 386, + "Ġmade": 949, + "Ġme": 968, + "Ġmore": 802, + "Ġmost": 910, + "Ġmov": 956, + "Ġmus": 966, + "Ġn": 415, + "Ġnew": 989, + "Ġno": 547, + "Ġnor": 978, + "Ġnot": 632, + "Ġnum": 926, + "Ġo": 359, + "Ġof": 373, + "Ġoff": 875, + "Ġon": 551, + "Ġon": 456, + "Ġone": 677, + "Ġonly": 871, + "Ġor": 699, + "Ġor": 645, + "Ġother": 787, + "Ġout": 925, + "Ġov": 729, + "Ġover": 856, + "Ġp": 379, + "Ġpar": 636, + "Ġper": 736, + "Ġpl": 698, + "Ġpla": 697, + "Ġplay": 808, + "Ġpos": 859, + "Ġpr": 889, + "Ġpre": 749, + "Ġpres": 912, + "Ġpro": 506, + "Ġproduc": 934, + "Ġqu": 955, + "Ġr": 521, + "Ġra": 863, + "Ġre": 400, + "Ġrec": 597, + "Ġrecor": 919, + "Ġreg": 943, + "Ġrel": 900, + "Ġrele": 946, + "Ġrem": 848, + "Ġrep": 762, + "Ġres": 650, + "Ġro": 629, + "Ġs": 361, + "Ġsa": 905, + "Ġsc": 732, + "Ġse": 569, + "Ġseason": 948, + "Ġsec": 781, + "Ġser": 740, + "Ġsev": 884, + "Ġsh": 513, + "Ġshe": 862, + "Ġsp": 578, + "Ġspec": 940, + "Ġst": 446, + "Ġstar": 939, + "Ġsu": 770, + "Ġsub": 969, + "Ġsuc": 764, + "Ġsuch": 981, + "Ġt": 354, + "Ġth": 355, + "Ġthan": 918, + "Ġthat": 452, + "Ġthe": 502, + "Ġthe": 357, + "Ġtheir": 621, + "Ġthem": 998, + "Ġthey": 727, + "Ġthis": 705, + "Ġthree": 902, + "Ġthroug": 923, + "Ġtime": 783, + "Ġto": 391, + "Ġtra": 836, + "Ġtw": 639, + "Ġtwo": 688, + "Ġun": 544, + "Ġup": 898, + "Ġus": 668, + "Ġused": 988, + "Ġv": 495, + "Ġw": 363, + "Ġwas": 422, + "Ġwere": 525, + "Ġwh": 443, + "Ġwhen": 851, + "Ġwhere": 995, + "Ġwhich": 573, + "Ġwhile": 935, + "Ġwho": 724, + "Ġwit": 451, + "Ġwith": 994, + "Ġwith": 466, + "Ġwor": 643, + "Ġwould": 801, + "Ġwrit": 937, + "Ġy": 580, + "Ġyear": 987, + "Ġâ": 556, + "ĠâĢ": 565, + "ĠâĢĵ": 631, + "ĠĊ": 412, + "Ģ": 161, + "Ģ": 223, + "ģ": 162, + "ģ": 273, + "Ĥ": 163, + "Ĥ": 262, + "ĥ": 164, + "ĥ": 337, + "Ħ": 165, + "Ħ": 278, + "ħ": 166, + "ħ": 281, + "Ĩ": 167, + "Ĩ": 308, + "ĩ": 168, + "ĩ": 225, + "Ī": 169, + "Ī": 221, + "ī": 170, + "ī": 244, + "Ĭ": 171, + "Ĭ": 315, + "ĭ": 172, + "ĭ": 321, + "Į": 173, + "Į": 324, + "į": 174, + "į": 302, + "İ": 175, + "İ": 249, + "ı": 176, + "ı": 332, + "IJ": 177, + "IJ": 295, + "ij": 178, + "ij": 313, + "Ĵ": 179, + "Ĵ": 328, + "ĵ": 180, + "ĵ": 312, + "Ķ": 181, + "Ķ": 256, + "ķ": 182, + "ķ": 314, + "ĸ": 183, + "ĸ": 277, + "Ĺ": 184, + "Ĺ": 322, + "ĺ": 185, + "ĺ": 285, + "Ļ": 186, + "Ļ": 267, + "ļ": 187, + "ļ": 290, + "Ľ": 188, + "Ľ": 311, + "ľ": 189, + "ľ": 299, + "Ŀ": 190, + "Ŀ": 291, + "ŀ": 191, + "ŀ": 293, + "Ł": 192, + "Ł": 335, + "ł": 193, + "ł": 252, + "Ń": 194, + "Ń": 297 +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/merges.txt b/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/merges.txt new file mode 100644 index 0000000..e9193d6 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/merges.txt @@ -0,0 +1,647 @@ +#version: 0.2 +Ġ t +Ġt h +Ġ a +Ġth e +i n +Ġ o +Ġ , +Ġ s +e d +Ġ w +e r +Ġ . +Ġ i +r e +Ġ c +n d +Ġ f +Ġ b +a t +Ġo f +e r +e n +a r +o r +i t +Ġ p +Ġ h +Ġa nd +o n +in g +a n +r o +Ġ m +Ġ d +e s +Ġi n +o n +Ġt o +o u +i s +Ġ a +i c +Ġ T +a l +Ġ l +Ġ = +Ġ re +Ġ " +e s +Ġ S +a s +a l +i l +e l +i on +Ġ A +Ġ C +Ġ 1 +Ġ Ċ +u r +ĠT h +Ġ n +a s +Ġ @ +e c +o m +a c +Ġ e +Ġw as +Ġ M +o r +a n +a m +e n +o l +Ġ in +Ġ g +Ġ ' +Ġ B +l y +a t +i v +t s +ĠTh e +u s +- @ +Ġ@ -@ +i s +Ġ I +Ġw h +i g +Ġ H +Ġs t +o s +u n +t h +Ġ P +Ġw it +Ġth at +i r +Ġa s +e m +Ġo n +r a +Ġf or +Ġ R +e t +o w +Ġ 2 +i d +Ġ D +l e +Ġwit h +l a +en t +i m +Ġ F +e a +i on +Ġb y +Ġ ) +Ġ ( +Ġa l +Ġc on +en t +Ġ W +Ġi s +er e +Ġ G +Ġ N +Ġ L +Ġh a +er s +r i +t h +t ed +u c +Ġ J +Ġ1 9 +e v +u l +Ġ v +c e +at ion +ro m +Ġb e +Ġ E +i n +Ġth e +Ġf rom +Ġ O +t er +Ġp ro +Ġa r +a d +Ġc om +i c +a g +Ġh is +Ġs h +Ġa t +o v +i es +o o +p p +s t +c h +Ġ r +Ġ2 0 +a y +i f +Ġw ere +Ġc h +u t +s t +u t +d s +o p +u m +Ġi t +o c +t er +l e +ig h +u d +Ġe x +ion s +at e +it y +at ed +Ġ un +e p +q u +Ġn o +Ġ K +iv e +is t +Ġo n +am e +ou n +i r +a b +Ġ â +in g +Ġh e +l d +u g +ic h +Ġa n +e d +Ġ k +Ġâ Ģ +Ġha d +v e +a in +Ġs e +t ion +or e +re s +Ġwh ich +ĠI n +o d +th er +a k +Ġs p +a r +Ġ y +ĠC h +on g +Ġa c +es t +Ġ U +a p +f f +al ly +r it +ĠS t +u b +g e +b er +e t +Ġb e +e ar +Ġre c +er s +Ġf ir +o t +Ġar e +Ġa n +c h +o g +i a +es t +in e +il l +an d +e l +ar y +e w +i d +Ġf or +Ġ ; +Ġcom p +Ġ V +Ġin c +t r +Ġ20 0 +Ġthe ir +u s +Ġb ut +r an +ic al +Ġfir st +Ġd e +Ġin t +Ġ ro +s o +ĠâĢ ĵ +Ġno t +d ing +f ter +ur e +Ġp ar +Ġ : +i an +Ġt w +ou ld +Ġal so +Ġi ts +Ġw or +u m +Ġo r +os t +0 0 +ou r +ar d +Ġre s +m p +u e +Ġa b +is h +Ġcon t +Ġa d +ow n +al l +ou g +Ġh er +as t +Ġ en +om e +al l +d ed +o w +Ġha ve +Ġ us +ea r +ac k +d uc +i al +s s +en ts +a in +t ing +Ġon e +es s +Ġh as +igh t +a v +Ġe v +ou t +a y +en ce +Ġbe en +e w +Ġtw o +Ġc l +d er +im e +k s +es s +is h +. @ +Ġ@ .@ +Ġp la +Ġp l +Ġo r +u p +m ent +ur ing +ol l +ĠI n +Ġth is +Ġb ec +Ġcom m +Ġd is +at er +ag e +Ġa pp +ou s +e y +i l +p er +ĠA l +ion al +l ud +el y +t t +il e +i z +Ġ j +Ġwh o +Ġa g +i b +Ġthe y +f or +Ġo v +at h +e g +Ġs c +i p +Ġ20 1 +Ġ 3 +Ġp er +or y +Ġd es +id e +Ġs er +s e +ĠH e +la nd +at ions +r ic +i t +re s +er ed +Ġp re +ĠS h +an ce +or t +an t +, @ +Ġ@ ,@ +el l +Ġ Y +n ed +el l +it e +Ġinc lud +Ġre p +Ġa fter +Ġs uc +re e +an y +i m +or t +Ġ1 8 +Ġs u +ad e +ou r +ĠU n +ĠI t +i k +ĠM ar +em ber +Ġ 1 +e en +a nd +Ġs ec +ic e +Ġt ime +ĠA n +Ġint o +Ġf in +Ġo ther +Ġa tt +il l +re n +ac h +as s +er al +es e +s h +al s +it ion +oug h +l es +am p +Ġw ould +Ġm ore +ro ug +ri b +er y +ac e +Ġ A +Ġpla y +it ed +k ed +is t +i ed +Ġ 2 +as ed +ing s +an g +a m +i p +Ġb o +ab le +t y +Ġch ar +Ġc ent +et w +at es +ro p +Ġ I +u nd +ĠA m +c es +o in +Ġin ter +u p +c t +on e +Ġt ra +an t +ec t +Ġal l +e f +Ġcon s +ub l +n ing +an s +Ġf e +us t +Ġ 0 +Ġre m +as e +on g +Ġwh en +e b +ĠW h +Ġe ar +ev er +Ġov er +Ġk n +a us +Ġp os +a d +er m +Ġsh e +Ġ ra +Ġd uring +as on +v i +Ġex p +Ġl ea +Ġ el +Ġ 4 +Ġon ly +o nd +Ġd ec +Ġac c +Ġo ff +is s +Ġf l +ĠE n +o t +en s +os e +ak e +o m +Ġs ev +ac h +etw een +er n +Ġ 3 +Ġp r +Ġg ro +r uc +Ġd i +Ġ19 9 +ĠA r +Ġg ame +Ġh im +oo k +Ġ up +Ġab out +Ġre l +for m +Ġth ree +at t +ĠC om +Ġs a +ear s +Ġ 5 +r y +Ġi mp +Ġm ost +f er +Ġp res +Ġf il +Ġb etween +Ġbe g +p h +or s +Ġth an +Ġrec or +o b +er ic +at ing +Ġth roug +k ing +Ġo ut +Ġn um +oo d +oll ow +ac t +u il +Ġc re +ol og +at ional +Ġpro duc +Ġwh ile +Ġl ater +Ġw rit +e x +Ġst ar +Ġsp ec +e e +ish ed +Ġre g +is ion +ou th +Ġre le +Ġa ss +Ġse ason +Ġm ade +il y +r u +o y +t ur +t e +Ġ qu +Ġm ov +ur y +ĠAm eric +em ent +c c +ou nd +Ġl ar +Ġfor m +ec t +Ġde f +Ġm us +ĠP ar +Ġm e +Ġs ub +w ay +o p +o h +el d +i e +em p +am es +er n +Ġn or +iv ed +ev el +Ġsuc h +ar ds +Ġin d +ik e +Ġg en +er t +Ġy ear +Ġus ed +Ġn ew +Ġ 5 +Ġal b +s p +y p +Ġwit h +Ġwh ere +ic s +ĠTh is +Ġthe m +w n diff --git a/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/special_tokens_map.json b/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/special_tokens_map.json new file mode 100644 index 0000000..2c2130b --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/special_tokens_map.json @@ -0,0 +1,24 @@ +{ + "bos_token": { + "content": "<|startoftext|>", + "lstrip": false, + "normalized": true, + "rstrip": false, + "single_word": false + }, + "eos_token": { + "content": "<|endoftext|>", + "lstrip": false, + "normalized": true, + "rstrip": false, + "single_word": false + }, + "pad_token": "<|endoftext|>", + "unk_token": { + "content": "<|endoftext|>", + "lstrip": false, + "normalized": true, + "rstrip": false, + "single_word": false + } +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/tokenizer_config.json b/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/tokenizer_config.json new file mode 100644 index 0000000..7eae593 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/tokenizer_config.json @@ -0,0 +1,30 @@ +{ + "add_prefix_space": false, + "added_tokens_decoder": { + "0": { + "content": "<|startoftext|>", + "lstrip": false, + "normalized": true, + "rstrip": false, + "single_word": false, + "special": true + }, + "1": { + "content": "<|endoftext|>", + "lstrip": false, + "normalized": true, + "rstrip": false, + "single_word": false, + "special": true + } + }, + "bos_token": "<|startoftext|>", + "clean_up_tokenization_spaces": true, + "do_lower_case": true, + "eos_token": "<|endoftext|>", + "errors": "replace", + "model_max_length": 77, + "pad_token": "<|endoftext|>", + "tokenizer_class": "CLIPTokenizer", + "unk_token": "<|endoftext|>" +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/vocab.json b/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/vocab.json new file mode 100644 index 0000000..609c08e --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/tokenizer_2/vocab.json @@ -0,0 +1,1002 @@ +{ + "!": 2, + "!": 345, + "\"": 3, + "\"": 344, + "#": 4, + "#": 325, + "$": 5, + "$": 348, + "%": 6, + "%": 351, + "&": 7, + "&": 352, + "'": 8, + "'": 296, + "(": 9, + "(": 318, + ")": 10, + ")": 330, + "*": 11, + "*": 327, + "+": 12, + "+": 341, + ",": 13, + ",": 279, + ",@": 754, + "-": 14, + "-": 276, + "-@": 439, + ".": 15, + ".": 253, + ".@": 695, + "/": 16, + "/": 350, + "0": 17, + "00": 647, + "0": 216, + "1": 18, + "1": 222, + "2": 19, + "2": 231, + "3": 20, + "3": 243, + "4": 21, + "4": 233, + "5": 22, + "5": 240, + "6": 23, + "6": 226, + "7": 24, + "7": 215, + "8": 25, + "8": 236, + "9": 26, + "9": 242, + ":": 27, + ":": 353, + ";": 28, + ";": 317, + "<": 29, + "<": 340, + "<|endoftext|>": 1, + "<|startoftext|>": 0, + "=": 30, + "=": 342, + ">": 31, + ">": 300, + "?": 32, + "?": 346, + "@": 33, + "@": 320, + "A": 34, + "A": 227, + "B": 35, + "B": 258, + "C": 36, + "C": 239, + "D": 37, + "D": 255, + "E": 38, + "E": 246, + "F": 39, + "F": 213, + "G": 40, + "G": 283, + "H": 41, + "H": 219, + "I": 42, + "I": 237, + "J": 43, + "J": 251, + "K": 44, + "K": 254, + "L": 45, + "L": 218, + "M": 46, + "M": 234, + "N": 47, + "N": 238, + "O": 48, + "O": 265, + "P": 49, + "P": 245, + "Q": 50, + "Q": 309, + "R": 51, + "R": 264, + "S": 52, + "S": 230, + "T": 53, + "T": 235, + "U": 54, + "U": 268, + "V": 55, + "V": 248, + "W": 56, + "W": 274, + "X": 57, + "X": 263, + "Y": 58, + "Y": 310, + "Z": 59, + "Z": 207, + "[": 60, + "[": 270, + "\\": 61, + "\\": 338, + "]": 62, + "]": 289, + "^": 63, + "^": 331, + "_": 64, + "_": 334, + "`": 65, + "`": 347, + "a": 66, + "a": 197, + "ab": 555, + "able": 820, + "ac": 420, + "ace": 806, + "ach": 791, + "ach": 885, + "ack": 670, + "act": 929, + "ad": 508, + "ad": 860, + "ade": 771, + "ag": 511, + "age": 710, + "ain": 568, + "ain": 675, + "ak": 577, + "ake": 882, + "al": 397, + "al": 405, + "all": 664, + "all": 658, + "ally": 588, + "als": 796, + "am": 426, + "am": 817, + "ame": 552, + "ames": 976, + "amp": 800, + "an": 384, + "an": 425, + "ance": 751, + "and": 609, + "and": 780, + "ang": 816, + "ans": 844, + "ant": 837, + "ant": 753, + "any": 766, + "ap": 586, + "ar": 376, + "ar": 579, + "ard": 649, + "ards": 982, + "ary": 611, + "as": 416, + "as": 404, + "ase": 849, + "ased": 814, + "ason": 865, + "ass": 792, + "ast": 661, + "at": 372, + "at": 434, + "ate": 541, + "ated": 543, + "ater": 709, + "ates": 825, + "ath": 730, + "ating": 922, + "ation": 497, + "ational": 933, + "ations": 744, + "att": 903, + "aus": 858, + "av": 681, + "ay": 684, + "ay": 523, + "b": 67, + "b": 212, + "ber": 593, + "c": 68, + "c": 224, + "cc": 960, + "ce": 496, + "ces": 830, + "ch": 520, + "ch": 603, + "ct": 834, + "d": 69, + "d": 196, + "ded": 665, + "der": 690, + "ding": 633, + "ds": 530, + "duc": 671, + "e": 70, + "e": 195, + "ea": 471, + "ear": 596, + "ear": 669, + "ears": 906, + "eb": 852, + "ec": 418, + "ect": 838, + "ect": 964, + "ed": 563, + "ed": 362, + "ee": 941, + "een": 779, + "ef": 840, + "eg": 731, + "el": 407, + "el": 610, + "eld": 973, + "ell": 759, + "ell": 756, + "ely": 719, + "em": 455, + "ember": 777, + "ement": 959, + "emp": 975, + "en": 375, + "en": 427, + "ence": 685, + "ens": 880, + "ent": 478, + "ent": 468, + "ents": 674, + "ep": 545, + "er": 364, + "er": 374, + "eral": 793, + "ere": 481, + "ered": 748, + "eric": 921, + "erm": 861, + "ern": 887, + "ern": 977, + "ers": 598, + "ers": 486, + "ert": 986, + "ery": 805, + "es": 402, + "es": 388, + "ese": 794, + "ess": 678, + "ess": 693, + "est": 606, + "est": 584, + "et": 460, + "et": 594, + "etw": 824, + "etween": 886, + "ev": 493, + "evel": 980, + "ever": 855, + "ew": 687, + "ew": 612, + "ex": 938, + "ey": 713, + "f": 71, + "f": 209, + "fer": 911, + "ff": 587, + "for": 728, + "form": 901, + "fter": 634, + "g": 72, + "g": 214, + "ge": 592, + "h": 73, + "h": 203, + "i": 74, + "i": 205, + "ia": 605, + "ial": 672, + "ian": 638, + "ib": 726, + "ic": 395, + "ic": 510, + "ical": 625, + "ice": 782, + "ich": 561, + "ics": 996, + "id": 463, + "id": 613, + "ide": 739, + "ie": 974, + "ied": 812, + "ies": 516, + "if": 524, + "ig": 444, + "igh": 537, + "ight": 680, + "ik": 775, + "ike": 984, + "il": 406, + "il": 714, + "ile": 721, + "ill": 608, + "ill": 789, + "ily": 950, + "im": 469, + "im": 767, + "ime": 691, + "in": 358, + "in": 501, + "ine": 607, + "ing": 557, + "ing": 383, + "ings": 815, + "ion": 472, + "ion": 408, + "ional": 717, + "ions": 540, + "ip": 733, + "ip": 818, + "ir": 453, + "ir": 554, + "is": 393, + "is": 441, + "ish": 694, + "ish": 654, + "ished": 942, + "ision": 944, + "iss": 876, + "ist": 550, + "ist": 811, + "it": 378, + "it": 746, + "ite": 760, + "ited": 809, + "ition": 797, + "ity": 542, + "iv": 435, + "ive": 549, + "ived": 979, + "iz": 722, + "j": 75, + "j": 288, + "k": 76, + "k": 210, + "ked": 810, + "king": 924, + "ks": 692, + "l": 77, + "l": 201, + "la": 467, + "land": 743, + "ld": 559, + "le": 536, + "le": 465, + "les": 799, + "lud": 718, + "ly": 433, + "m": 78, + "m": 202, + "ment": 701, + "mp": 651, + "n": 79, + "n": 199, + "nd": 369, + "ned": 758, + "ning": 843, + "o": 80, + "o": 198, + "ob": 920, + "oc": 534, + "od": 575, + "og": 604, + "oh": 972, + "oin": 831, + "ol": 428, + "oll": 703, + "ollow": 928, + "olog": 932, + "om": 419, + "om": 883, + "ome": 663, + "on": 382, + "on": 390, + "ond": 872, + "one": 835, + "ong": 850, + "ong": 582, + "oo": 517, + "ood": 927, + "ook": 897, + "op": 531, + "op": 971, + "or": 377, + "or": 424, + "ore": 571, + "ors": 917, + "ort": 768, + "ort": 752, + "ory": 737, + "os": 447, + "ose": 881, + "ost": 646, + "ot": 600, + "ot": 879, + "ou": 392, + "oug": 659, + "ough": 798, + "ould": 640, + "oun": 553, + "ound": 961, + "our": 648, + "our": 772, + "ous": 712, + "out": 683, + "outh": 945, + "ov": 515, + "ow": 461, + "ow": 666, + "own": 657, + "oy": 952, + "p": 81, + "p": 217, + "per": 715, + "ph": 916, + "pp": 518, + "q": 82, + "q": 280, + "qu": 546, + "r": 83, + "r": 204, + "ra": 457, + "ran": 624, + "re": 367, + "ree": 765, + "ren": 790, + "res": 572, + "res": 747, + "ri": 487, + "rib": 804, + "ric": 745, + "rit": 589, + "ro": 385, + "rom": 498, + "rop": 826, + "roug": 803, + "ru": 951, + "ruc": 891, + "ry": 908, + "s": 84, + "s": 206, + "se": 741, + "sh": 795, + "so": 630, + "sp": 992, + "ss": 673, + "st": 519, + "st": 528, + "t": 85, + "t": 208, + "te": 954, + "ted": 489, + "ter": 535, + "ter": 505, + "th": 449, + "th": 488, + "ther": 576, + "ting": 676, + "tion": 570, + "tr": 619, + "ts": 436, + "tt": 720, + "tur": 953, + "ty": 821, + "u": 86, + "u": 229, + "ub": 591, + "ubl": 842, + "uc": 490, + "ud": 538, + "ue": 652, + "ug": 560, + "uil": 930, + "ul": 494, + "um": 532, + "um": 644, + "un": 448, + "und": 828, + "up": 833, + "up": 700, + "ur": 413, + "ure": 635, + "uring": 702, + "ury": 957, + "us": 438, + "us": 622, + "ust": 846, + "ut": 529, + "ut": 527, + "v": 87, + "v": 232, + "ve": 567, + "vi": 866, + "w": 88, + "w": 250, + "way": 970, + "wn": 999, + "x": 89, + "x": 269, + "y": 90, + "y": 211, + "yp": 993, + "z": 91, + "z": 228, + "|": 92, + "|": 304, + "}": 93, + "}": 336, + "~": 94, + "~": 343, + "¡": 95, + "¡": 220, + "¢": 96, + "¢": 306, + "£": 97, + "£": 323, + "¤": 98, + "¤": 292, + "¥": 99, + "¥": 339, + "¦": 100, + "¦": 303, + "§": 101, + "§": 275, + "¨": 102, + "¨": 282, + "©": 103, + "©": 259, + "ª": 104, + "ª": 286, + "«": 105, + "«": 266, + "¬": 106, + "¬": 319, + "®": 107, + "®": 329, + "¯": 108, + "¯": 287, + "°": 109, + "°": 298, + "±": 110, + "±": 200, + "²": 111, + "²": 284, + "³": 112, + "³": 272, + "´": 113, + "´": 307, + "µ": 114, + "µ": 261, + "¶": 115, + "¶": 301, + "·": 116, + "·": 326, + "¸": 117, + "¸": 257, + "¹": 118, + "¹": 241, + "º": 119, + "º": 260, + "»": 120, + "»": 247, + "¼": 121, + "¼": 305, + "½": 122, + "½": 294, + "¾": 123, + "¾": 316, + "¿": 124, + "¿": 271, + "Â": 125, + "Ã": 126, + "Ä": 127, + "Å": 128, + "Æ": 129, + "Ç": 130, + "È": 131, + "É": 132, + "Ê": 133, + "Ë": 134, + "Ì": 135, + "Í": 136, + "Î": 137, + "Ï": 138, + "Ð": 139, + "Ñ": 140, + "Ö": 141, + "×": 142, + "Ø": 143, + "Ù": 144, + "Ü": 145, + "à": 146, + "á": 147, + "â": 148, + "ã": 149, + "ä": 150, + "å": 151, + "æ": 152, + "ç": 153, + "è": 154, + "é": 155, + "ë": 156, + "ì": 157, + "ï": 158, + "Ċ": 159, + "Ċ": 349, + "Ġ": 160, + "Ġ\"": 401, + "Ġ'": 431, + "Ġ(": 475, + "Ġ)": 474, + "Ġ,": 360, + "Ġ.": 365, + "Ġ0": 847, + "Ġ1": 411, + "Ġ18": 769, + "Ġ19": 492, + "Ġ199": 893, + "Ġ1": 778, + "Ġ2": 462, + "Ġ20": 522, + "Ġ200": 620, + "Ġ201": 734, + "Ġ2": 813, + "Ġ3": 735, + "Ġ3": 888, + "Ġ4": 870, + "Ġ5": 907, + "Ġ5": 990, + "Ġ:": 637, + "Ġ;": 615, + "Ġ": 333, + "Ġ=": 399, + "Ġ@": 417, + "Ġ@,@": 755, + "Ġ@-@": 440, + "Ġ@.@": 696, + "ĠA": 409, + "ĠA": 807, + "ĠAl": 716, + "ĠAm": 829, + "ĠAmeric": 958, + "ĠAn": 784, + "ĠAr": 894, + "ĠB": 432, + "ĠC": 410, + "ĠCh": 581, + "ĠCom": 904, + "ĠD": 464, + "ĠE": 500, + "ĠEn": 878, + "ĠF": 470, + "ĠG": 482, + "ĠH": 445, + "ĠHe": 742, + "ĠI": 442, + "ĠI": 827, + "ĠIn": 704, + "ĠIn": 574, + "ĠIt": 774, + "ĠJ": 491, + "ĠK": 548, + "ĠL": 484, + "ĠM": 423, + "ĠMar": 776, + "ĠN": 483, + "ĠO": 504, + "ĠP": 450, + "ĠPar": 967, + "ĠR": 459, + "ĠS": 403, + "ĠSh": 750, + "ĠSt": 590, + "ĠT": 396, + "ĠTh": 414, + "ĠThe": 437, + "ĠThis": 997, + "ĠU": 585, + "ĠUn": 773, + "ĠV": 617, + "ĠW": 479, + "ĠWh": 853, + "ĠY": 757, + "Ġa": 356, + "Ġa": 394, + "Ġab": 653, + "Ġabout": 899, + "Ġac": 583, + "Ġacc": 874, + "Ġad": 656, + "Ġafter": 763, + "Ġag": 725, + "Ġal": 476, + "Ġalb": 991, + "Ġall": 839, + "Ġalso": 641, + "Ġan": 602, + "Ġan": 562, + "Ġand": 381, + "Ġapp": 711, + "Ġar": 507, + "Ġare": 601, + "Ġas": 454, + "Ġass": 947, + "Ġat": 514, + "Ġatt": 788, + "Ġb": 371, + "Ġbe": 499, + "Ġbe": 595, + "Ġbec": 706, + "Ġbeen": 686, + "Ġbeg": 915, + "Ġbetween": 914, + "Ġbo": 819, + "Ġbut": 623, + "Ġby": 473, + "Ġc": 368, + "Ġcent": 823, + "Ġch": 526, + "Ġchar": 822, + "Ġcl": 689, + "Ġcom": 509, + "Ġcomm": 707, + "Ġcomp": 616, + "Ġcon": 477, + "Ġcons": 841, + "Ġcont": 655, + "Ġcre": 931, + "Ġd": 387, + "Ġde": 627, + "Ġdec": 873, + "Ġdef": 965, + "Ġdes": 738, + "Ġdi": 892, + "Ġdis": 708, + "Ġduring": 864, + "Ġe": 421, + "Ġear": 854, + "Ġel": 869, + "Ġen": 662, + "Ġev": 682, + "Ġex": 539, + "Ġexp": 867, + "Ġf": 370, + "Ġfe": 845, + "Ġfil": 913, + "Ġfin": 786, + "Ġfir": 599, + "Ġfirst": 626, + "Ġfl": 877, + "Ġfor": 614, + "Ġfor": 458, + "Ġform": 963, + "Ġfrom": 503, + "Ġg": 430, + "Ġgame": 895, + "Ġgen": 985, + "Ġgro": 890, + "Ġh": 380, + "Ġha": 485, + "Ġhad": 566, + "Ġhas": 679, + "Ġhave": 667, + "Ġhe": 558, + "Ġher": 660, + "Ġhim": 896, + "Ġhis": 512, + "Ġi": 366, + "Ġimp": 909, + "Ġin": 429, + "Ġin": 389, + "Ġinc": 618, + "Ġinclud": 761, + "Ġind": 983, + "Ġint": 628, + "Ġinter": 832, + "Ġinto": 785, + "Ġis": 480, + "Ġit": 533, + "Ġits": 642, + "Ġj": 723, + "Ġk": 564, + "Ġkn": 857, + "Ġl": 398, + "Ġlar": 962, + "Ġlater": 936, + "Ġlea": 868, + "Ġm": 386, + "Ġmade": 949, + "Ġme": 968, + "Ġmore": 802, + "Ġmost": 910, + "Ġmov": 956, + "Ġmus": 966, + "Ġn": 415, + "Ġnew": 989, + "Ġno": 547, + "Ġnor": 978, + "Ġnot": 632, + "Ġnum": 926, + "Ġo": 359, + "Ġof": 373, + "Ġoff": 875, + "Ġon": 551, + "Ġon": 456, + "Ġone": 677, + "Ġonly": 871, + "Ġor": 699, + "Ġor": 645, + "Ġother": 787, + "Ġout": 925, + "Ġov": 729, + "Ġover": 856, + "Ġp": 379, + "Ġpar": 636, + "Ġper": 736, + "Ġpl": 698, + "Ġpla": 697, + "Ġplay": 808, + "Ġpos": 859, + "Ġpr": 889, + "Ġpre": 749, + "Ġpres": 912, + "Ġpro": 506, + "Ġproduc": 934, + "Ġqu": 955, + "Ġr": 521, + "Ġra": 863, + "Ġre": 400, + "Ġrec": 597, + "Ġrecor": 919, + "Ġreg": 943, + "Ġrel": 900, + "Ġrele": 946, + "Ġrem": 848, + "Ġrep": 762, + "Ġres": 650, + "Ġro": 629, + "Ġs": 361, + "Ġsa": 905, + "Ġsc": 732, + "Ġse": 569, + "Ġseason": 948, + "Ġsec": 781, + "Ġser": 740, + "Ġsev": 884, + "Ġsh": 513, + "Ġshe": 862, + "Ġsp": 578, + "Ġspec": 940, + "Ġst": 446, + "Ġstar": 939, + "Ġsu": 770, + "Ġsub": 969, + "Ġsuc": 764, + "Ġsuch": 981, + "Ġt": 354, + "Ġth": 355, + "Ġthan": 918, + "Ġthat": 452, + "Ġthe": 502, + "Ġthe": 357, + "Ġtheir": 621, + "Ġthem": 998, + "Ġthey": 727, + "Ġthis": 705, + "Ġthree": 902, + "Ġthroug": 923, + "Ġtime": 783, + "Ġto": 391, + "Ġtra": 836, + "Ġtw": 639, + "Ġtwo": 688, + "Ġun": 544, + "Ġup": 898, + "Ġus": 668, + "Ġused": 988, + "Ġv": 495, + "Ġw": 363, + "Ġwas": 422, + "Ġwere": 525, + "Ġwh": 443, + "Ġwhen": 851, + "Ġwhere": 995, + "Ġwhich": 573, + "Ġwhile": 935, + "Ġwho": 724, + "Ġwit": 451, + "Ġwith": 994, + "Ġwith": 466, + "Ġwor": 643, + "Ġwould": 801, + "Ġwrit": 937, + "Ġy": 580, + "Ġyear": 987, + "Ġâ": 556, + "ĠâĢ": 565, + "ĠâĢĵ": 631, + "ĠĊ": 412, + "Ģ": 161, + "Ģ": 223, + "ģ": 162, + "ģ": 273, + "Ĥ": 163, + "Ĥ": 262, + "ĥ": 164, + "ĥ": 337, + "Ħ": 165, + "Ħ": 278, + "ħ": 166, + "ħ": 281, + "Ĩ": 167, + "Ĩ": 308, + "ĩ": 168, + "ĩ": 225, + "Ī": 169, + "Ī": 221, + "ī": 170, + "ī": 244, + "Ĭ": 171, + "Ĭ": 315, + "ĭ": 172, + "ĭ": 321, + "Į": 173, + "Į": 324, + "į": 174, + "į": 302, + "İ": 175, + "İ": 249, + "ı": 176, + "ı": 332, + "IJ": 177, + "IJ": 295, + "ij": 178, + "ij": 313, + "Ĵ": 179, + "Ĵ": 328, + "ĵ": 180, + "ĵ": 312, + "Ķ": 181, + "Ķ": 256, + "ķ": 182, + "ķ": 314, + "ĸ": 183, + "ĸ": 277, + "Ĺ": 184, + "Ĺ": 322, + "ĺ": 185, + "ĺ": 285, + "Ļ": 186, + "Ļ": 267, + "ļ": 187, + "ļ": 290, + "Ľ": 188, + "Ľ": 311, + "ľ": 189, + "ľ": 299, + "Ŀ": 190, + "Ŀ": 291, + "ŀ": 191, + "ŀ": 293, + "Ł": 192, + "Ł": 335, + "ł": 193, + "ł": 252, + "Ń": 194, + "Ń": 297 +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/unet/config.json b/tests/models-sd/SDXL/tiny-sdxl/unet/config.json new file mode 100644 index 0000000..9d376ef --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/unet/config.json @@ -0,0 +1,68 @@ +{ + "_class_name": "UNet2DConditionModel", + "_diffusers_version": "0.28.0.dev0", + "_name_or_path": "/home/imgen/.cache/huggingface/hub/models--hf-internal-testing--tiny-stable-diffusion-xl-pipe/snapshots/fa06b5c3d6d45fabd978486616c6dae068519e85/unet", + "act_fn": "silu", + "addition_embed_type": "text_time", + "addition_embed_type_num_heads": 64, + "addition_time_embed_dim": 8, + "attention_head_dim": [ + 2, + 4 + ], + "attention_type": "default", + "block_out_channels": [ + 32, + 64 + ], + "center_input_sample": false, + "class_embed_type": null, + "class_embeddings_concat": false, + "conv_in_kernel": 3, + "conv_out_kernel": 3, + "cross_attention_dim": 64, + "cross_attention_norm": null, + "down_block_types": [ + "DownBlock2D", + "CrossAttnDownBlock2D" + ], + "downsample_padding": 1, + "dropout": 0.0, + "dual_cross_attention": false, + "encoder_hid_dim": null, + "encoder_hid_dim_type": null, + "flip_sin_to_cos": true, + "freq_shift": 0, + "in_channels": 4, + "layers_per_block": 2, + "mid_block_only_cross_attention": null, + "mid_block_scale_factor": 1, + "mid_block_type": "UNetMidBlock2DCrossAttn", + "norm_eps": 1e-05, + "norm_num_groups": 32, + "num_attention_heads": null, + "num_class_embeds": null, + "only_cross_attention": false, + "out_channels": 4, + "projection_class_embeddings_input_dim": 80, + "resnet_out_scale_factor": 1.0, + "resnet_skip_time_act": false, + "resnet_time_scale_shift": "default", + "reverse_transformer_layers_per_block": null, + "sample_size": 32, + "time_cond_proj_dim": null, + "time_embedding_act_fn": null, + "time_embedding_dim": null, + "time_embedding_type": "positional", + "timestep_post_act": null, + "transformer_layers_per_block": [ + 1, + 2 + ], + "up_block_types": [ + "CrossAttnUpBlock2D", + "UpBlock2D" + ], + "upcast_attention": false, + "use_linear_projection": true +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/unet/diffusion_pytorch_model.safetensors b/tests/models-sd/SDXL/tiny-sdxl/unet/diffusion_pytorch_model.safetensors new file mode 100644 index 0000000..f36b7b8 Binary files /dev/null and b/tests/models-sd/SDXL/tiny-sdxl/unet/diffusion_pytorch_model.safetensors differ diff --git a/tests/models-sd/SDXL/tiny-sdxl/vae/config.json b/tests/models-sd/SDXL/tiny-sdxl/vae/config.json new file mode 100644 index 0000000..1473e55 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl/vae/config.json @@ -0,0 +1,28 @@ +{ + "_class_name": "AutoencoderKL", + "_diffusers_version": "0.28.0.dev0", + "_name_or_path": "/home/imgen/.cache/huggingface/hub/models--hf-internal-testing--tiny-stable-diffusion-xl-pipe/snapshots/fa06b5c3d6d45fabd978486616c6dae068519e85/vae", + "act_fn": "silu", + "block_out_channels": [ + 32, + 64 + ], + "down_block_types": [ + "DownEncoderBlock2D", + "DownEncoderBlock2D" + ], + "force_upcast": true, + "in_channels": 3, + "latent_channels": 4, + "latents_mean": null, + "latents_std": null, + "layers_per_block": 1, + "norm_num_groups": 32, + "out_channels": 3, + "sample_size": 128, + "scaling_factor": 0.18215, + "up_block_types": [ + "UpDecoderBlock2D", + "UpDecoderBlock2D" + ] +} diff --git a/tests/models-sd/SDXL/tiny-sdxl/vae/diffusion_pytorch_model.safetensors b/tests/models-sd/SDXL/tiny-sdxl/vae/diffusion_pytorch_model.safetensors new file mode 100644 index 0000000..64840ac Binary files /dev/null and b/tests/models-sd/SDXL/tiny-sdxl/vae/diffusion_pytorch_model.safetensors differ diff --git a/tests/models-sd/SDXL/tiny-sdxl1 b/tests/models-sd/SDXL/tiny-sdxl1 new file mode 120000 index 0000000..286f127 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl1 @@ -0,0 +1 @@ +tiny-sdxl/ \ No newline at end of file diff --git a/tests/models-sd/SDXL/tiny-sdxl2 b/tests/models-sd/SDXL/tiny-sdxl2 new file mode 120000 index 0000000..286f127 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl2 @@ -0,0 +1 @@ +tiny-sdxl/ \ No newline at end of file diff --git a/tests/models-sd/SDXL/tiny-sdxl3 b/tests/models-sd/SDXL/tiny-sdxl3 new file mode 120000 index 0000000..286f127 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl3 @@ -0,0 +1 @@ +tiny-sdxl/ \ No newline at end of file diff --git a/tests/models-sd/SDXL/tiny-sdxl4 b/tests/models-sd/SDXL/tiny-sdxl4 new file mode 120000 index 0000000..286f127 --- /dev/null +++ b/tests/models-sd/SDXL/tiny-sdxl4 @@ -0,0 +1 @@ +tiny-sdxl/ \ No newline at end of file diff --git a/tests/models.yaml b/tests/models.yaml new file mode 100644 index 0000000..8fffeae --- /dev/null +++ b/tests/models.yaml @@ -0,0 +1,21 @@ +base: + netta: + id: SDXL/tiny-sdxl1 + xl: True + sdxl1: + id: SDXL/tiny-sdxl2 + xl: True + jug: + id: SDXL/tiny-sdxl3 + xl: True + nih: + id: SDXL/tiny-sdxl4 + xl: True + +pipes: + prompt2image: + name: "Prompt to Image" + classname: Prompt2ImPipe + need_imgs: False + needs_cnet: False + diff --git a/tests/pipe_test.py b/tests/pipe_test.py index fe46665..3556fb6 100644 --- a/tests/pipe_test.py +++ b/tests/pipe_test.py @@ -90,7 +90,10 @@ def test_loader(self): cls = MaskedIm2ImPipe._classxl else: cls = MaskedIm2ImPipe._class - pipeline = loader.load_pipeline(cls, model_id) + device = torch.device('cpu') + if torch.cuda.is_available(): + device = torch.device('cuda', 0) + pipeline = loader.load_pipeline(cls, model_id, device=device) inpaint = MaskedIm2ImPipe(model_id, pipe=pipeline) # create prompt2im pipe @@ -98,10 +101,11 @@ def test_loader(self): cls = Prompt2ImPipe._classxl else: cls = Prompt2ImPipe._class - pipeline = loader.load_pipeline(cls, model_id) + pipeline = loader.load_pipeline(cls, model_id, device=device) prompt2image = Prompt2ImPipe(model_id, pipe=pipeline) prompt2image.setup(width=512, height=512, scheduler="DPMSolverMultistepScheduler", clip_skip=2, steps=5) - self.assertEqual(inpaint.pipe.unet.conv_out.weight.data_ptr(), + if device.type == 'cuda': + self.assertEqual(inpaint.pipe.unet.conv_out.weight.data_ptr(), prompt2image.pipe.unet.conv_out.weight.data_ptr(), "unets are different") diff --git a/tests/test_worker.py b/tests/test_worker.py new file mode 100755 index 0000000..ceebbc4 --- /dev/null +++ b/tests/test_worker.py @@ -0,0 +1,89 @@ +import os +import shutil +import time +import torch +import unittest +import yaml +import logging +from multigen.prompting import Cfgen +from multigen.sessions import GenSession +from multigen.pipes import Prompt2ImPipe + +from multigen.worker import ServiceThread +from multigen.log import setup_logger + +setup_logger() + + + +nprompt = "jpeg artifacts, blur, distortion, watermark, signature, extra fingers, fewer fingers, lowres, bad hands, duplicate heads, bad anatomy, bad crop" + +prompt = "Close-up portrait of a woman wearing suit posing with black background, rim lighting, octane, unreal" +seed = 383947828373273 + + +class WorkerTestCase(unittest.TestCase): + def setUp(self): + self.cfg_file = 'config.yaml' + self.models_conf = yaml.safe_load(open('models.yaml')) + self.worker = ServiceThread(self.cfg_file) + self.worker.start() + + def test_multisessions(self): + if not torch.cuda.is_available(): + print('no gpu to run test_multisessions') + return True + + pipe = "prompt2image" + num_models = 4 + sessions = [] + for model in self.models_conf['base'].keys(): + result = self.worker.open_session( + user='test' + model, + project="results" + model, + model=model, + pipe=pipe, + ) + if 'error' in result: + raise RuntimeError("can't open session") + sessions.append(result['session_id']) + + count = 5 + c = 0 + def on_new_image(*args, **kwargs): + print(args, kwargs) + nonlocal c + c += 1 + + num_runs = 15 + for i in range(num_runs): + if len(sessions) - 1 < i: + i %= len(sessions) + sess_id = sessions[i] + self.worker.queue_gen(session_id=sess_id, + images=None, + prompt=prompt, pipe='Prompt2ImPipe', + image_callback=on_new_image, + lpw=True, + width=1024, height=1024, steps=5, + timestep_spacing='trailing', + guidance_scale=0, + scheduler='EulerAncestralDiscreteScheduler', + count=count, + seeds=[seed + i for i in range(count)], + ) + timeout = 1000 + while timeout and count * num_runs != c: + time.sleep(1) + timeout -= 1 + self.assertEqual(count * num_runs, c, 'not enough images generated') + + def tearDown(self): + self.worker.stop() + for dir in os.listdir('./_projects'): + if dir.startswith('test'): + shutil.rmtree(os.path.join('_projects', dir)) + + +if __name__ == '__main__': + unittest.main()