|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from typing import Union |
|
|
|
|
|
import numpy as np |
|
|
import torch |
|
|
|
|
|
from diffusers.configuration_utils import ConfigMixin |
|
|
from diffusers.models.modeling_utils import ModelMixin |
|
|
|
|
|
|
|
|
class DummyCosmosSafetyChecker(ModelMixin, ConfigMixin): |
|
|
def __init__(self) -> None: |
|
|
super().__init__() |
|
|
|
|
|
self._dtype = torch.float32 |
|
|
|
|
|
def check_text_safety(self, prompt: str) -> bool: |
|
|
return True |
|
|
|
|
|
def check_video_safety(self, frames: np.ndarray) -> np.ndarray: |
|
|
return frames |
|
|
|
|
|
def to(self, device: Union[str, torch.device] = None, dtype: torch.dtype = None) -> None: |
|
|
self._dtype = dtype |
|
|
|
|
|
@property |
|
|
def device(self) -> torch.device: |
|
|
return None |
|
|
|
|
|
@property |
|
|
def dtype(self) -> torch.dtype: |
|
|
return self._dtype |
|
|
|