负面提示会阻止模型生成不希望的内容。此参数通常用于通过删除较差或较差的功能(如“低分辨率”或“较差的细节”)来提高整体生成质量。
import os os.environ["HF_ENDPOINT"] = "https://hf-mirror.com" import torch from diffusers import AnimateDiffPipeline, DDIMScheduler, MotionAdapter from diffusers.utils import export_to_gif adapter = MotionAdapter.from_pretrained("guoyww/animatediff-motion-adapter-v1-5-2", torch_dtype=torch.float16) pipeline = AnimateDiffPipeline.from_pretrained("emilianJR/epiCRealism", motion_adapter=adapter, torch_dtype=torch.float16) scheduler = DDIMScheduler.from_pretrained( "emilianJR/epiCRealism", subfolder="scheduler", clip_sample=False, timestep_spacing="linspace", beta_schedule="linear", steps_offset=1, ) pipeline.scheduler = scheduler pipeline.enable_vae_slicing() pipeline.enable_model_cpu_offload() output = pipeline( prompt="360 camera shot of a sushi roll in a restaurant", negative_prompt="Distorted, discontinuous, ugly, blurry, low resolution, motionless, static", num_frames=16, guidance_scale=7.5, num_inference_steps=50, generator=torch.Generator("cpu").manual_seed(0), ) frames = output.frames[0] export_to_gif(frames, "animation.gif")