1 注释掉
##loadsafetymodel
#safety_model_id="CompVis/stable-diffusion-safety-checker"
#safety_feature_extractor=AutoFeatureExtractor.from_pretrained(safety_model_id)
#safety_checker=StableDiffusionSafetyChecker.from_pretrained(safety_model_id)
修改一下这个方法
def check_safety(x_image):
#假设x_image是一个包含多张图像的批次
#创建一个与输入图像数量相同的has_nsfw_concept列表,所有值都为False
has_nsfw_concept=[False]* len(x_image)
#直接返回输入的图像和has_nsfw_concept列表
return x_image,has_nsfw_concept
2 下载
openai/clip-vit-large-patch14