Instructions to use vidfom/Wav2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use vidfom/Wav2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("vidfom/Wav2", 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
| from diffsynth.extensions.ImageQualityMetric import download_preference_model, load_preference_model | |
| from modelscope import dataset_snapshot_download | |
| from PIL import Image | |
| # Download example image | |
| dataset_snapshot_download( | |
| dataset_id="DiffSynth-Studio/examples_in_diffsynth", | |
| allow_file_pattern="data/examples/ImageQualityMetric/image.jpg", | |
| local_dir="./" | |
| ) | |
| # Parameters | |
| prompt = "an orange cat" | |
| image = Image.open("data/examples/ImageQualityMetric/image.jpg") | |
| device = "cuda" | |
| cache_dir = "./models" | |
| # Run preference models | |
| for model_name in ["ImageReward", "Aesthetic", "PickScore", "CLIP", "HPSv2", "HPSv2.1", "MPS"]: | |
| path = download_preference_model(model_name, cache_dir=cache_dir) | |
| preference_model = load_preference_model(model_name, device=device, path=path) | |
| print(model_name, preference_model.score(image, prompt)) | |