class_docstr: Flax-based pipeline for text-guided image inpainting using Stable Diffusion.
  
  <Tip warning={true}>
  
  🧪 This is an experimental feature!
  
  </Tip>
  
  This model inherits from [`FlaxDiffusionPipeline`]. Check the superclass documentation for the generic methods
  implemented for all pipelines (downloading, saving, running on a particular device, etc.).
  
  Args:
      vae ([`FlaxAutoencoderKL`]):
          Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations.
      text_encoder ([`~transformers.FlaxCLIPTextModel`]):
          Frozen text-encoder ([clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14)).
      tokenizer ([`~transformers.CLIPTokenizer`]):
          A `CLIPTokenizer` to tokenize text.
      unet ([`FlaxUNet2DConditionModel`]):
          A `FlaxUNet2DConditionModel` to denoise the encoded image latents.
      scheduler ([`SchedulerMixin`]):
          A scheduler to be used in combination with `unet` to denoise the encoded image latents. Can be one of
          [`FlaxDDIMScheduler`], [`FlaxLMSDiscreteScheduler`], [`FlaxPNDMScheduler`], or
          [`FlaxDPMSolverMultistepScheduler`].
      safety_checker ([`FlaxStableDiffusionSafetyChecker`]):
          Classification module that estimates whether generated images could be considered offensive or harmful.
          Please refer to the [model card](https://huggingface.co/runwayml/stable-diffusion-v1-5) for more details
          about a model's potential harms.
      feature_extractor ([`~transformers.CLIPImageProcessor`]):
          A `CLIPImageProcessor` to extract features from generated images; used as inputs to the `safety_checker`.
class_docstr_tok: ["Flax-based","pipeline","for","text-guided","image","inpainting","using","Stable","Diffusion",".","<","Tip","warning=","{","true","}",">","\ud83e\uddea","This","is","an","experimental","feature","!","<","\/Tip",">","This","model","inherits","from","[","`","FlaxDiffusionPipeline","`","]",".","Check","the","superclass","documentation","for","the","generic","methods","implemented","for","all","pipelines","(","downloading",",","saving",",","running","on","a","particular","device",",","etc.",")",".","Args",":","vae","(","[","`","FlaxAutoencoderKL","`","]",")",":","Variational","Auto-Encoder","(","VAE",")","model","to","encode","and","decode","images","to","and","from","latent","representations",".","text_encoder","(","[","`","~transformers.FlaxCLIPTextModel","`","]",")",":","Frozen","text-encoder","(","[","clip-vit-large-patch14","]","(","https",":","\/\/huggingface.co\/openai\/clip-vit-large-patch14",")",")",".","tokenizer","(","[","`","~transformers.CLIPTokenizer","`","]",")",":","A","`","CLIPTokenizer","`","to","tokenize","text",".","unet","(","[","`","FlaxUNet2DConditionModel","`","]",")",":","A","`","FlaxUNet2DConditionModel","`","to","denoise","the","encoded","image","latents",".","scheduler","(","[","`","SchedulerMixin","`","]",")",":","A","scheduler","to","be","used","in","combination","with","`","unet","`","to","denoise","the","encoded","image","latents",".","Can","be","one","of","[","`","FlaxDDIMScheduler","`","]",",","[","`","FlaxLMSDiscreteScheduler","`","]",",","[","`","FlaxPNDMScheduler","`","]",",","or","[","`","FlaxDPMSolverMultistepScheduler","`","]",".","safety_checker","(","[","`","FlaxStableDiffusionSafetyChecker","`","]",")",":","Classification","module","that","estimates","whether","generated","images","could","be","considered","offensive","or","harmful",".","Please","refer","to","the","[","model","card","]","(","https",":","\/\/huggingface.co\/runwayml\/stable-diffusion-v1-5",")","for","more","details","about","a","model","'s","potential","harms",".","feature_extractor","(","[","`","~transformers.CLIPImageProcessor","`","]",")",":","A","`","CLIPImageProcessor","`","to","extract","features","from","generated","images",";","used","as","inputs","to","the","`","safety_checker","`","."]
code: def _run_safety_checker(self, images, safety_model_params, jit=False):
      # safety_model_params should already be replicated when jit is True
      pil_images = [Image.fromarray(image) for image in images]
      features = self.feature_extractor(
          pil_images, return_tensors="np"
      ).pixel_values
  
      if jit:
          features = shard(features)
          has_nsfw_concepts = _p_get_has_nsfw_concepts(
              self, features, safety_model_params
          )
          has_nsfw_concepts = unshard(has_nsfw_concepts)
          safety_model_params = unreplicate(safety_model_params)
      else:
          has_nsfw_concepts = self._get_has_nsfw_concepts(
              features, safety_model_params
          )
  
      images_was_copied = False
      for idx, has_nsfw_concept in enumerate(has_nsfw_concepts):
          if has_nsfw_concept:
              if not images_was_copied:
                  images_was_copied = True
                  images = images.copy()
  
              images[idx] = np.zeros(
                  images[idx].shape, dtype=np.uint8
              )  # black image
  
          if any(has_nsfw_concepts):
              warnings.warn(
                  "Potential NSFW content was detected in one or more images. A black image will be returned"
                  " instead. Try again with a different prompt and/or seed."
              )
  
      return images, has_nsfw_concepts
  
imports: import warnings
  from functools import partial
  from typing import Dict, List, Optional, Union
  import jax
  import jax.numpy
  import numpy
  from flax.core.frozen_dict import FrozenDict
  from flax.jax_utils import unreplicate
  from flax.training.common_utils import shard
  from packaging import version
  from PIL import Image
  from transformers import CLIPImageProcessor, CLIPTokenizer, FlaxCLIPTextModel
  from ...models import FlaxAutoencoderKL, FlaxUNet2DConditionModel
  from ...schedulers import FlaxDDIMScheduler, FlaxDPMSolverMultistepScheduler, FlaxLMSDiscreteScheduler, FlaxPNDMScheduler
  from ...utils import PIL_INTERPOLATION, deprecate, logging, replace_example_docstring
  from ..pipeline_flax_utils import FlaxDiffusionPipeline
  from .pipeline_output import FlaxStableDiffusionPipelineOutput
  from .safety_checker_flax import FlaxStableDiffusionSafetyChecker
label_desc: Use image node_id 4 for calling the FlaxStableDiffusionInpaintPipeline obj's underlying member method code with example usage: obj._run_safety_checker(images, safety_model_params, jit) and returns: images,  has_nsfw_concepts