fix --safety_checker arg parsing

and add note to diffusers loader about where safety checker gets called
This commit is contained in:
Kevin Turner 2022-12-12 16:17:10 -08:00
parent e32b82a480
commit 0b48f2e801
2 changed files with 17 additions and 12 deletions

View File

@ -81,18 +81,18 @@ with metadata_from_png():
"""
import argparse
from argparse import Namespace, RawTextHelpFormatter
import pydoc
import json
import hashlib
import os
import re
import sys
import shlex
import copy
import base64
import copy
import functools
import warnings
import hashlib
import json
import os
import pydoc
import re
import shlex
import sys
from argparse import Namespace
import ldm.invoke.pngwriter
from ldm.invoke.globals import Globals
from ldm.invoke.prompt_parser import split_weighted_subprompts
@ -477,7 +477,7 @@ class Args(object):
default='auto',
)
model_group.add_argument(
'--nsfw_checker'
'--nsfw_checker',
'--safety_checker',
action=argparse.BooleanOptionalAction,
dest='safety_checker',

View File

@ -356,7 +356,12 @@ class ModelCache(object):
pipeline = StableDiffusionGeneratorPipeline.from_pretrained(
name_or_path,
safety_checker=None, # TODO
# TODO: Safety checker is currently handled at a different stage in the code:
# ldm.invoke.generator.base.Generator.safety_check
# We might want to move that here for consistency with diffusers API, or we might
# want to leave it as a separate processing node. It ends up using the same diffusers
# code either way, so we can table it for now.
safety_checker=None,
# TODO: alternate VAE
# TODO: local_files_only=True
**pipeline_args