From e64fdcf2ce98303fda3103c3d54e44d7928b033c Mon Sep 17 00:00:00 2001 From: pravdomil <2387356+pravdomil@users.noreply.github.com> Date: Sat, 9 Mar 2024 19:53:17 +0100 Subject: [PATCH] Fix gmflow_dir (#6583) * remove sys.path * update readme --- examples/community/README.md | 8 +++----- examples/community/rerender_a_video.py | 8 +------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/examples/community/README.md b/examples/community/README.md index 9f9e118ccf3f..cf1e4cdd579d 100755 --- a/examples/community/README.md +++ b/examples/community/README.md @@ -3414,15 +3414,13 @@ pipeline(prompt, uncond, inverted_latent, guidance_scale=7.5, num_inference_step ### Rerender A Video -This is the Diffusers implementation of zero-shot video-to-video translation pipeline [Rerender A Video](https://github.com/williamyang1991/Rerender_A_Video) (without Ebsynth postprocessing). To run the code, please install gmflow. Then modify the path in `examples/community/rerender_a_video.py`: +This is the Diffusers implementation of zero-shot video-to-video translation pipeline [Rerender A Video](https://github.com/williamyang1991/Rerender_A_Video) (without Ebsynth postprocessing). To run the code, please install gmflow. Then modify the path in `gmflow_dir`. After that, you can run the pipeline with: ```py +import sys gmflow_dir = "/path/to/gmflow" -``` - -After that, you can run the pipeline with: +sys.path.insert(0, gmflow_dir) -```py from diffusers import ControlNetModel, AutoencoderKL, DDIMScheduler from diffusers.utils import export_to_video import numpy as np diff --git a/examples/community/rerender_a_video.py b/examples/community/rerender_a_video.py index 9668e49b0607..95406e0865c7 100644 --- a/examples/community/rerender_a_video.py +++ b/examples/community/rerender_a_video.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Tuple, Union @@ -21,6 +20,7 @@ import torch import torch.nn.functional as F import torchvision.transforms as T +from gmflow.gmflow import GMFlow from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers.image_processor import VaeImageProcessor @@ -32,12 +32,6 @@ from diffusers.schedulers import KarrasDiffusionSchedulers from diffusers.utils import BaseOutput, deprecate, logging from diffusers.utils.torch_utils import is_compiled_module, randn_tensor - - -gmflow_dir = "/path/to/gmflow" -sys.path.insert(0, gmflow_dir) -from gmflow.gmflow import GMFlow # noqa: E402 - from utils.utils import InputPadder # noqa: E402