Card: the node can fetch the checkpoint itself when features.network is on
Browse files
README.md
CHANGED
|
@@ -1,123 +1,129 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
tags:
|
| 4 |
-
- video-frame-interpolation
|
| 5 |
-
- frame-interpolation
|
| 6 |
-
- video
|
| 7 |
-
- comfyui
|
| 8 |
-
- ema-vfi
|
| 9 |
-
---
|
| 10 |
-
|
| 11 |
-
# EMA-VFI, released checkpoints as safetensors
|
| 12 |
-
|
| 13 |
-
The four checkpoints released with **EMA-VFI**, converted from the original pickles to
|
| 14 |
-
safetensors and nothing else. The weights are unchanged, tensor for tensor.
|
| 15 |
-
|
| 16 |
-
Upstream: <https://github.com/MCG-NJU/EMA-VFI>. This is a mirror, not a new model. All credit
|
| 17 |
-
for the network and the training belongs to its authors.
|
| 18 |
-
|
| 19 |
-
## Why this exists
|
| 20 |
-
|
| 21 |
-
The originals are distributed as bare `state_dict` **pickles** inside a Google Drive folder.
|
| 22 |
-
That is two problems for anyone building on them. A pickle executes arbitrary code when it is
|
| 23 |
-
loaded, and a Drive folder gives out per-file links that are not stable enough to script
|
| 24 |
-
against, so tools end up telling people to fetch a file by hand.
|
| 25 |
-
|
| 26 |
-
Safetensors cannot execute anything on load, and a Hub URL stays put.
|
| 27 |
-
|
| 28 |
-
## The files
|
| 29 |
-
|
| 30 |
-
| File | Size | Parameters | Quality | Multiplier above 2 |
|
| 31 |
-
|---|--:|--:|---|---|
|
| 32 |
-
| `ours_t.safetensors` | 250.5 MiB | 65.66M | best | **yes** |
|
| 33 |
-
| `ours.safetensors` | 250.5 MiB | 65.66M | best | no |
|
| 34 |
-
| `ours_small_t.safetensors` | 55.3 MiB | 14.49M | lower | **yes** |
|
| 35 |
-
| `ours_small.safetensors` | 55.3 MiB | 14.49M | lower | no |
|
| 36 |
-
|
| 37 |
-
Take **`ours_t`** unless you have a reason not to. The `_t` pair was trained to land anywhere
|
| 38 |
-
between two frames, so it can do 3x, 4x and beyond. The other two only ever land halfway, which
|
| 39 |
-
limits them to a multiplier of 2. The `small` pair is a narrower network: quicker, and visibly
|
| 40 |
-
weaker on fast motion.
|
| 41 |
-
|
| 42 |
-
## Provenance
|
| 43 |
-
|
| 44 |
-
Every file was downloaded from the authors' own Drive folder, `16jUa3HkQ85Z5lb5gce1yoaWkP-rdCd0o`,
|
| 45 |
-
linked from the upstream README. No third-party mirror was used.
|
| 46 |
-
|
| 47 |
-
| Original | SHA-256 of the source pickle |
|
| 48 |
-
|---|---|
|
| 49 |
-
| `ours_t.pkl` | `c09e82d193e303d7b91f1e36bf535886b820cb56105574355211d60a6b557a99` |
|
| 50 |
-
| `ours.pkl` | `f9085bb32d8b2eaa70eb1df08cc25bc7e973c50a74d74fb593ebe0d5e100a11f` |
|
| 51 |
-
| `ours_small_t.pkl` | `ad845671f7250d408937718aca19eaf87aa1ca79215070f7641eea332b703233` |
|
| 52 |
-
| `ours_small.pkl` | `ef0e455a7fe75c24d415bbcd83c29a9c0134ba853942bde0cd4dc4ed01e3f98f` |
|
| 53 |
-
|
| 54 |
-
Each hash is repeated in its safetensors file's own metadata, under `source_sha256`, alongside
|
| 55 |
-
the architecture the weights belong to. `conversion_report.json` in this repo records the whole
|
| 56 |
-
run.
|
| 57 |
-
|
| 58 |
-
## What was checked before publishing
|
| 59 |
-
|
| 60 |
-
1. Loaded with `torch.load(weights_only=True)`, which refuses arbitrary pickle opcodes, so a
|
| 61 |
-
payload would have raised rather than run.
|
| 62 |
-
2. Built the network at the matching size and required `load_state_dict(strict=True)`, which
|
| 63 |
-
proves the tensors really are this architecture and that none is missing or spare.
|
| 64 |
-
3. Reloaded each converted file and required the same strict fit, then compared every tensor
|
| 65 |
-
against the original with `torch.equal`. All exact.
|
| 66 |
-
|
| 67 |
-
## What the conversion changed
|
| 68 |
-
|
| 69 |
-
Two things, both mechanical, and both what a loader had to do anyway:
|
| 70 |
-
|
| 71 |
-
- **The `module.` prefix is stripped.** The originals were saved from a `DataParallel` wrapper,
|
| 72 |
-
so every key carried it.
|
| 73 |
-
- **`attn_mask` and `HW` are dropped.** These are shifted-window buffers the backbone registers
|
| 74 |
-
during `forward` from whatever padded size it is given, so a saved pair belongs to the
|
| 75 |
-
resolution it was trained at and is wrong at any other. Upstream's own loader drops them too.
|
| 76 |
-
8 such keys in the full models, 4 in the small ones.
|
| 77 |
-
|
| 78 |
-
Everything else is byte-identical, float32 throughout.
|
| 79 |
-
|
| 80 |
-
## Use it in ComfyUI
|
| 81 |
-
|
| 82 |
-
With [WAS Node Suite](https://github.com/WASasquatch/was-node-suite-comfyui) and its
|
| 83 |
-
**EMA-VFI Frame Interpolation** node
|
| 84 |
-
|
| 85 |
-
```
|
| 86 |
-
ComfyUI/models/EMA-VFI
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- video-frame-interpolation
|
| 5 |
+
- frame-interpolation
|
| 6 |
+
- video
|
| 7 |
+
- comfyui
|
| 8 |
+
- ema-vfi
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# EMA-VFI, released checkpoints as safetensors
|
| 12 |
+
|
| 13 |
+
The four checkpoints released with **EMA-VFI**, converted from the original pickles to
|
| 14 |
+
safetensors and nothing else. The weights are unchanged, tensor for tensor.
|
| 15 |
+
|
| 16 |
+
Upstream: <https://github.com/MCG-NJU/EMA-VFI>. This is a mirror, not a new model. All credit
|
| 17 |
+
for the network and the training belongs to its authors.
|
| 18 |
+
|
| 19 |
+
## Why this exists
|
| 20 |
+
|
| 21 |
+
The originals are distributed as bare `state_dict` **pickles** inside a Google Drive folder.
|
| 22 |
+
That is two problems for anyone building on them. A pickle executes arbitrary code when it is
|
| 23 |
+
loaded, and a Drive folder gives out per-file links that are not stable enough to script
|
| 24 |
+
against, so tools end up telling people to fetch a file by hand.
|
| 25 |
+
|
| 26 |
+
Safetensors cannot execute anything on load, and a Hub URL stays put.
|
| 27 |
+
|
| 28 |
+
## The files
|
| 29 |
+
|
| 30 |
+
| File | Size | Parameters | Quality | Multiplier above 2 |
|
| 31 |
+
|---|--:|--:|---|---|
|
| 32 |
+
| `ours_t.safetensors` | 250.5 MiB | 65.66M | best | **yes** |
|
| 33 |
+
| `ours.safetensors` | 250.5 MiB | 65.66M | best | no |
|
| 34 |
+
| `ours_small_t.safetensors` | 55.3 MiB | 14.49M | lower | **yes** |
|
| 35 |
+
| `ours_small.safetensors` | 55.3 MiB | 14.49M | lower | no |
|
| 36 |
+
|
| 37 |
+
Take **`ours_t`** unless you have a reason not to. The `_t` pair was trained to land anywhere
|
| 38 |
+
between two frames, so it can do 3x, 4x and beyond. The other two only ever land halfway, which
|
| 39 |
+
limits them to a multiplier of 2. The `small` pair is a narrower network: quicker, and visibly
|
| 40 |
+
weaker on fast motion.
|
| 41 |
+
|
| 42 |
+
## Provenance
|
| 43 |
+
|
| 44 |
+
Every file was downloaded from the authors' own Drive folder, `16jUa3HkQ85Z5lb5gce1yoaWkP-rdCd0o`,
|
| 45 |
+
linked from the upstream README. No third-party mirror was used.
|
| 46 |
+
|
| 47 |
+
| Original | SHA-256 of the source pickle |
|
| 48 |
+
|---|---|
|
| 49 |
+
| `ours_t.pkl` | `c09e82d193e303d7b91f1e36bf535886b820cb56105574355211d60a6b557a99` |
|
| 50 |
+
| `ours.pkl` | `f9085bb32d8b2eaa70eb1df08cc25bc7e973c50a74d74fb593ebe0d5e100a11f` |
|
| 51 |
+
| `ours_small_t.pkl` | `ad845671f7250d408937718aca19eaf87aa1ca79215070f7641eea332b703233` |
|
| 52 |
+
| `ours_small.pkl` | `ef0e455a7fe75c24d415bbcd83c29a9c0134ba853942bde0cd4dc4ed01e3f98f` |
|
| 53 |
+
|
| 54 |
+
Each hash is repeated in its safetensors file's own metadata, under `source_sha256`, alongside
|
| 55 |
+
the architecture the weights belong to. `conversion_report.json` in this repo records the whole
|
| 56 |
+
run.
|
| 57 |
+
|
| 58 |
+
## What was checked before publishing
|
| 59 |
+
|
| 60 |
+
1. Loaded with `torch.load(weights_only=True)`, which refuses arbitrary pickle opcodes, so a
|
| 61 |
+
payload would have raised rather than run.
|
| 62 |
+
2. Built the network at the matching size and required `load_state_dict(strict=True)`, which
|
| 63 |
+
proves the tensors really are this architecture and that none is missing or spare.
|
| 64 |
+
3. Reloaded each converted file and required the same strict fit, then compared every tensor
|
| 65 |
+
against the original with `torch.equal`. All exact.
|
| 66 |
+
|
| 67 |
+
## What the conversion changed
|
| 68 |
+
|
| 69 |
+
Two things, both mechanical, and both what a loader had to do anyway:
|
| 70 |
+
|
| 71 |
+
- **The `module.` prefix is stripped.** The originals were saved from a `DataParallel` wrapper,
|
| 72 |
+
so every key carried it.
|
| 73 |
+
- **`attn_mask` and `HW` are dropped.** These are shifted-window buffers the backbone registers
|
| 74 |
+
during `forward` from whatever padded size it is given, so a saved pair belongs to the
|
| 75 |
+
resolution it was trained at and is wrong at any other. Upstream's own loader drops them too.
|
| 76 |
+
8 such keys in the full models, 4 in the small ones.
|
| 77 |
+
|
| 78 |
+
Everything else is byte-identical, float32 throughout.
|
| 79 |
+
|
| 80 |
+
## Use it in ComfyUI
|
| 81 |
+
|
| 82 |
+
With [WAS Node Suite](https://github.com/WASasquatch/was-node-suite-comfyui) and its
|
| 83 |
+
**EMA-VFI Frame Interpolation** node, either way round.
|
| 84 |
+
|
| 85 |
+
**Let it fetch.** Set `features.network: true` in the pack's `config.yaml`, pick a checkpoint in
|
| 86 |
+
the node's menu and queue the graph. The file is downloaded once into `ComfyUI/models/EMA-VFI`
|
| 87 |
+
and kept. Nothing is fetched at startup, only on the run that needs it.
|
| 88 |
+
|
| 89 |
+
**Or place it yourself.** Download the file and put it here:
|
| 90 |
+
|
| 91 |
+
```
|
| 92 |
+
ComfyUI/models/EMA-VFI/ours_t.safetensors
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
Create the `EMA-VFI` directory if it is not there, and restart ComfyUI. The checkpoint list is
|
| 96 |
+
read when the node builds its schema, so a file added while ComfyUI is running does not appear
|
| 97 |
+
until it restarts.
|
| 98 |
+
|
| 99 |
+
Keep the filename as it is. The node picks the architecture from the name, so a renamed file
|
| 100 |
+
will not be recognised.
|
| 101 |
+
|
| 102 |
+
## Use it in plain torch
|
| 103 |
+
|
| 104 |
+
The network itself is not in this repo. Take it from upstream, or from
|
| 105 |
+
`modules/vendor/ema_vfi` in WAS Node Suite, then:
|
| 106 |
+
|
| 107 |
+
```python
|
| 108 |
+
from safetensors.torch import load_file
|
| 109 |
+
|
| 110 |
+
state = load_file("ours_t.safetensors")
|
| 111 |
+
net.load_state_dict(state, strict=True) # no prefix to strip, no keys to drop
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
## Licence
|
| 115 |
+
|
| 116 |
+
Apache-2.0, as released by the authors: "This project is released under the Apache 2.0 license."
|
| 117 |
+
The full text is in `LICENSE` beside these files.
|
| 118 |
+
|
| 119 |
+
## Citation
|
| 120 |
+
|
| 121 |
+
```bibtex
|
| 122 |
+
@inproceedings{zhang2023extracting,
|
| 123 |
+
title={Extracting motion and appearance via inter-frame attention for efficient video frame interpolation},
|
| 124 |
+
author={Zhang, Guozhen and Zhu, Yuhan and Wang, Haonan and Chen, Youxin and Wu, Gangshan and Wang, Limin},
|
| 125 |
+
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
|
| 126 |
+
pages={5682--5692},
|
| 127 |
+
year={2023}
|
| 128 |
+
}
|
| 129 |
+
```
|