Comments (1)
refer to this issue #27, I modified the save_videos_grid method in animatediff\utils\util.py with this. It will place each frame of the generation in "frames" directory.
def save_videos_grid(videos: torch.Tensor, path: str, rescale=False, n_rows=6, fps=8):
# make frames dir
frame_dir = os.path.join(os.path.dirname(path), 'frames')
os.makedirs(frame_dir, exist_ok=True)
videos = rearrange(videos, "b c t h w -> t b c h w")
os.makedirs(os.path.dirname(path), exist_ok=True)
video_output = path.replace(".gif", ".mp4")
writer = imageio.get_writer(video_output, fps=fps)
outputs = []
for i, x in enumerate(videos):
x = torchvision.utils.make_grid(x, nrow=n_rows)
x = x.transpose(0, 1).transpose(1, 2).squeeze(-1)
if rescale:
x = (x + 1.0) / 2.0
x = (x * 255).numpy().astype(np.uint8)
# saved frames as PNG
img_path = os.path.join(frame_dir, '%06d.png' % i)
imageio.imwrite(img_path, x)
outputs.append(x)
writer.append_data(x)
imageio.mimsave(path, outputs, fps=fps)
writer.close()
had to run:
pip install imageio[ffmpeg]
afterwards
from animatediff.
Related Issues (20)
- sparsectrl 4090显存都不够
- I use image_finetune.yaml to fine-tune the model, and I found that the first step of each epoch would get stuck for 5 minutes HOT 5
- ModuleNotFoundError: No module named 'scripts.animatediff_mm'
- AttributeError: 'UiControlNetUnit' object has no attribute 'enable'
- MotionLoRA training HOT 2
- Wall of Error messages: "Error running before_process", "Missing keys from State_dict", "AttributeError: 'CFGDenoiserParams' object has no attribute 'denoiser'". and even "Shape mismatch, can't divide axis of length 2 in chunks of 16"
- AnimateDiff v2 runs fine, v3 throws error (MotionWrapper state_dict / enable_gn_hack errors)
- animatediff_mm.py", line 43, in load raise RuntimeError("Please download models manually.")
- How to generate a gif image with pure green background? HOT 2
- Reproducing inference with depth maps
- Asking for image layer in Unet training HOT 1
- difference between finetuning the unet's image layers and training motion modules
- How to train Sparsecontrol?
- Any plan to support Apple M1/M2/M3 chips ? HOT 1
- RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
- motion module not in drop down list HOT 1
- update request
- AnimateDiff插件里面 Motion module 是空的 HOT 1
- How to reproduce demo in SparseCtrol, e.g., Keyframe and Video Interpolation, Video Prediction
- About temporal_position_encoding HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from animatediff.