Instructions to use mzx/NEvo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use mzx/NEvo with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("mzx/NEvo", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Quickstart one-line video save + export helper
Browse files- README.md +2 -2
- stimulus_synthesis/media/__init__.py +2 -1
README.md
CHANGED
|
@@ -71,6 +71,7 @@ Minimal runtime dependencies: `torch`, `diffusers`, `transformers`, `huggingface
|
|
| 71 |
|
| 72 |
```python
|
| 73 |
from stimulus_synthesis import NevoPipeline
|
|
|
|
| 74 |
|
| 75 |
# config (referenced model ids) is fetched from the Hub; weights are pulled on first use
|
| 76 |
pipe = NevoPipeline.from_pretrained("epfl-neuroai/NEvo")
|
|
@@ -83,8 +84,7 @@ out = pipe(
|
|
| 83 |
seed=0,
|
| 84 |
)
|
| 85 |
print(out.best_prompt, out.best_score)
|
| 86 |
-
out.best.
|
| 87 |
-
out.best.video # list of frames
|
| 88 |
```
|
| 89 |
|
| 90 |
### Targeting a brain region
|
|
|
|
| 71 |
|
| 72 |
```python
|
| 73 |
from stimulus_synthesis import NevoPipeline
|
| 74 |
+
from stimulus_synthesis.media import save_video, video_to_t_c_h_w
|
| 75 |
|
| 76 |
# config (referenced model ids) is fetched from the Hub; weights are pulled on first use
|
| 77 |
pipe = NevoPipeline.from_pretrained("epfl-neuroai/NEvo")
|
|
|
|
| 84 |
seed=0,
|
| 85 |
)
|
| 86 |
print(out.best_prompt, out.best_score)
|
| 87 |
+
save_video(video_to_t_c_h_w(out.best.video), "best_stimulus.mp4") # save the synthesized video
|
|
|
|
| 88 |
```
|
| 89 |
|
| 90 |
### Targeting a brain region
|
stimulus_synthesis/media/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from .asset_decode import DecodedImage, DecodedVideo, decode_image, decode_video
|
| 2 |
from .asset_export import AssetExportRecord, export_image, export_video, sha256_file
|
| 3 |
from .asset_spec import ImageAssetSpec, VideoAssetSpec
|
| 4 |
-
from .normalize import videos_to_b_t_c_h_w
|
| 5 |
from .video_io import load_video_as_tensor, save_video
|
| 6 |
|
| 7 |
__all__ = [
|
|
@@ -17,5 +17,6 @@ __all__ = [
|
|
| 17 |
"load_video_as_tensor",
|
| 18 |
"save_video",
|
| 19 |
"sha256_file",
|
|
|
|
| 20 |
"videos_to_b_t_c_h_w",
|
| 21 |
]
|
|
|
|
| 1 |
from .asset_decode import DecodedImage, DecodedVideo, decode_image, decode_video
|
| 2 |
from .asset_export import AssetExportRecord, export_image, export_video, sha256_file
|
| 3 |
from .asset_spec import ImageAssetSpec, VideoAssetSpec
|
| 4 |
+
from .normalize import video_to_t_c_h_w, videos_to_b_t_c_h_w
|
| 5 |
from .video_io import load_video_as_tensor, save_video
|
| 6 |
|
| 7 |
__all__ = [
|
|
|
|
| 17 |
"load_video_as_tensor",
|
| 18 |
"save_video",
|
| 19 |
"sha256_file",
|
| 20 |
+
"video_to_t_c_h_w",
|
| 21 |
"videos_to_b_t_c_h_w",
|
| 22 |
]
|