Run this model with HF Jobs
Run Agnes-AI/Agnes-Video-H3-MoE on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Agnes-AI/Agnes-Video-H3-MoE. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Agnes-AI/Agnes-Video-H3-MoE on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Download deploy/diffsynth/metrics/aesthetic.py from Agnes-AI/Agnes-Video-H3-MoE: direct link, hf CLI and curl.
- Browser
- Download file 1.61 kB
-
https://huggingface.co/Agnes-AI/Agnes-Video-H3-MoE/resolve/main/deploy/diffsynth/metrics/aesthetic.py
- Command line
-
hf download hf://Agnes-AI/Agnes-Video-H3-MoE/deploy/diffsynth/metrics/aesthetic.py
-
curl -L -o aesthetic.py https://huggingface.co/Agnes-AI/Agnes-Video-H3-MoE/resolve/main/deploy/diffsynth/metrics/aesthetic.py
1.61 kB
| import torch | |
| from ..core import ModelConfig | |
| from ..core.device.npu_compatible_device import get_device_type | |
| from ..models.aesthetic import AestheticModel | |
| from .base import Metric | |
| from transformers import CLIPImageProcessor | |
| class AestheticMetric(Metric): | |
| def __init__(self, model: AestheticModel): | |
| super().__init__() | |
| self.model = model | |
| def from_pretrained( | |
| cls, | |
| model_config: ModelConfig = ModelConfig(model_id="DiffSynth-Studio/ImageMetrics", origin_file_pattern="Aesthetic/model.safetensors"), | |
| processor_config: ModelConfig = ModelConfig(model_id="DiffSynth-Studio/ImageMetrics", origin_file_pattern="Aesthetic/"), | |
| torch_dtype: torch.dtype = None, | |
| device: torch.device = get_device_type(), | |
| processor_kwargs: dict = None, | |
| vram_limit: float = None, | |
| ): | |
| processor_kwargs = processor_kwargs or {} | |
| model_pool = cls.download_and_load_models([model_config], torch_dtype=torch_dtype, device=device, vram_limit=vram_limit) | |
| model = model_pool.fetch_model("image_metrics_aesthetic") | |
| processor_config.download_if_necessary() | |
| model.processor = CLIPImageProcessor.from_pretrained(processor_config.path, **processor_kwargs) | |
| model.layers = model.layers.float() | |
| model = model.eval() | |
| return cls(model) | |
| def score(self, images): | |
| scores = self.model(images) | |
| return self.tensor_to_list(scores) | |
| def compute(self, images): | |
| return self.score(images) | |
| def forward(self, images): | |
| return self.score(images) | |