Instructions to use agkavin/Avatar-Speech with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use agkavin/Avatar-Speech with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("agkavin/Avatar-Speech", 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
- Local Apps Settings
- llama.cpp
How to use agkavin/Avatar-Speech with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf agkavin/Avatar-Speech:Q4_K_M # Run inference directly in the terminal: llama cli -hf agkavin/Avatar-Speech:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf agkavin/Avatar-Speech:Q4_K_M # Run inference directly in the terminal: llama cli -hf agkavin/Avatar-Speech:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf agkavin/Avatar-Speech:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf agkavin/Avatar-Speech:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf agkavin/Avatar-Speech:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf agkavin/Avatar-Speech:Q4_K_M
Use Docker
docker model run hf.co/agkavin/Avatar-Speech:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use agkavin/Avatar-Speech with Ollama:
ollama run hf.co/agkavin/Avatar-Speech:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use agkavin/Avatar-Speech with Docker Model Runner:
docker model run hf.co/agkavin/Avatar-Speech:Q4_K_M
- Lemonade
How to use agkavin/Avatar-Speech with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull agkavin/Avatar-Speech:Q4_K_M
Run and chat with the model
lemonade run user.Avatar-Speech-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Download backend/models/loader.py from agkavin/Avatar-Speech: direct link, hf CLI and curl.
- Browser
- Download file 2.6 kB
-
https://huggingface.co/agkavin/Avatar-Speech/resolve/main/backend/models/loader.py
- Command line
-
hf download hf://agkavin/Avatar-Speech/backend/models/loader.py
-
curl -L -o loader.py https://huggingface.co/agkavin/Avatar-Speech/resolve/main/backend/models/loader.py
2.6 kB
| """ | |
| Speech-X Model Loader - Standalone Version | |
| ========================================= | |
| Loads the complete MuseTalk v1.5 inference stack | |
| """ | |
| from __future__ import annotations | |
| import logging | |
| import sys | |
| from dataclasses import dataclass | |
| from pathlib import Path | |
| import torch | |
| # Use relative imports for standalone | |
| import sys | |
| from pathlib import Path | |
| _backend_dir = Path(__file__).parent.parent | |
| if str(_backend_dir) not in sys.path: | |
| sys.path.insert(0, str(_backend_dir)) | |
| from config import ( | |
| DEVICE, | |
| WEIGHTS_DIR, | |
| MUSETALK_UNET_FP16, | |
| ) | |
| log = logging.getLogger(__name__) | |
| def _ensure_musetalk_on_path() -> None: | |
| """Add backend/ to sys.path so `musetalk.*` imports resolve.""" | |
| p = str(Path(__file__).parent.parent) | |
| if p not in sys.path: | |
| sys.path.insert(0, p) | |
| class ModelBundle: | |
| """ | |
| All models needed by the Speech-X pipeline. | |
| vae : musetalk VAE wrapper (.vae is diffusers AutoencoderKL) | |
| unet : musetalk UNet wrapper (.model is diffusers UNet) | |
| pe : PositionalEncoding nn.Module | |
| audio_processor : musetalk AudioProcessor (HF feature extractor) | |
| whisper : transformers.WhisperModel (encoder-only) | |
| timesteps : torch.tensor([0]) on device | |
| device : torch device string | |
| weight_dtype : torch.float16 or float32 | |
| """ | |
| vae: object | |
| unet: object | |
| pe: object | |
| audio_processor: object | |
| whisper: object | |
| timesteps: torch.Tensor | |
| device: str | |
| weight_dtype: torch.dtype | |
| def load_all_models(avatar_name: str = "christine") -> ModelBundle: | |
| """ | |
| Load all models needed for MuseTalk inference. | |
| This is the main entry point - call once at startup. | |
| """ | |
| from musetalk.worker import load_musetalk_models | |
| log.info("Loading all MuseTalk models...") | |
| bundle = load_musetalk_models(avatar_name=avatar_name, device=DEVICE) | |
| return ModelBundle( | |
| vae=bundle.vae, | |
| unet=bundle.unet, | |
| pe=bundle.pe, | |
| audio_processor=bundle.audio_processor, | |
| whisper=bundle.whisper, | |
| timesteps=bundle.timesteps, | |
| device=bundle.whisper.device, | |
| weight_dtype=torch.float16 if MUSETALK_UNET_FP16 else torch.float32, | |
| ) | |
| def prewarm_models(bundle: ModelBundle) -> None: | |
| """Run a warmup inference to optimize GPU kernels.""" | |
| import numpy as np | |
| log.info("Warming up models...") | |
| # Warmup whisper | |
| dummy_audio = np.zeros(16000, dtype=np.float32) | |
| # Note: actual warmup would call whisper encoder | |
| log.info("Models warmed up") | |