YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

🐱 Cat Meow AI Generator

Cat Meow AI PyTorch License Audio Generation

A Variational Autoencoder (VAE) trained to generate realistic cat meow sounds

🎡 Listen to Samples β€’ πŸ’» Quick Start β€’ πŸ“– Documentation


🎡 Generated Audio Samples

Listen to AI-generated cat meows! These sounds were created entirely by the model.

Random Generations

Sample Description Audio
Meow 1 Short meow
Meow 2 Medium meow
Meow 3 Long meow
Meow 4 High pitch
Meow 5 Low pitch

Interpolation Sequence

A smooth transition between two different meow styles:

Variations

Subtle variations of the same base meow:

Variation 1 Variation 2 Variation 3

πŸ“‹ Model Description

This model is a Variational Autoencoder (VAE) trained on the liladhii/cat-meow-sounds dataset. It learns to encode cat meow sounds into a compact latent space and can generate new, unique meow sounds by sampling from this space.

Key Features

  • 🎯 Realistic Generation: Produces natural-sounding cat meows
  • πŸŽ›οΈ Controllable: Adjust temperature for variety vs. quality tradeoff
  • πŸ”„ Interpolation: Smoothly morph between different meow styles
  • 🎨 Variations: Create subtle variations of any meow
  • ⚑ Fast: Generate audio in milliseconds on GPU

How It Works

Audio β†’ Mel Spectrogram β†’ Encoder β†’ Latent Space (z) β†’ Decoder β†’ Mel Spectrogram β†’ Audio
                              ↓
                    Sample random z to generate new meows

πŸ’» Quick Start

Installation

pip install torch torchaudio librosa soundfile numpy

Basic Usage

import torch
import torch.nn as nn
import librosa
import soundfile as sf
import numpy as np

# Download the checkpoint
from huggingface_hub import hf_hub_download

checkpoint_path = hf_hub_download(
    repo_id="liladhii/meowVAE03-335K",
    filename="meowVAE03-335K.pth"
)

# Load the model (see full code below)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
checkpoint = torch.load(checkpoint_path, map_location=device)

# Generate a meow!
z = torch.randn(1, 128).to(device) * 0.8
mel = model.decode(z)
# ... convert to audio

Full Inference Code

import torch
import torch.nn as nn
import librosa
import soundfile as sf
import numpy as np
from huggingface_hub import hf_hub_download

# ============================================
# MODEL DEFINITION
# ============================================
class MeowVAE(nn.Module):
    def __init__(self, h, w, latent_dim):
        super().__init__()
        self.h, self.w = h, w
        self.latent_dim = latent_dim
        
        # Encoder
        self.enc = nn.Sequential(
            nn.Conv2d(1, 32, 4, 2, 1), nn.BatchNorm2d(32), nn.LeakyReLU(0.2),
            nn.Conv2d(32, 64, 4, 2, 1), nn.BatchNorm2d(64), nn.LeakyReLU(0.2),
            nn.Conv2d(64, 128, 4, 2, 1), nn.BatchNorm2d(128), nn.LeakyReLU(0.2),
            nn.Conv2d(128, 256, 4, 2, 1), nn.BatchNorm2d(256), nn.LeakyReLU(0.2),
            nn.Flatten()
        )
        
        with torch.no_grad():
            dummy = torch.zeros(1, 1, h, w)
            flat_size = self.enc(dummy).shape[1]
        
        self.fc_mu = nn.Linear(flat_size, latent_dim)
        self.fc_var = nn.Linear(flat_size, latent_dim)
        self.fc_dec = nn.Linear(latent_dim, flat_size)
        
        self.dec_h = h // 16
        self.dec_w = w // 16
        self.flat_size = flat_size
        
        # Decoder
        self.dec = nn.Sequential(
            nn.ConvTranspose2d(256, 128, 4, 2, 1), nn.BatchNorm2d(128), nn.ReLU(),
            nn.ConvTranspose2d(128, 64, 4, 2, 1), nn.BatchNorm2d(64), nn.ReLU(),
            nn.ConvTranspose2d(64, 32, 4, 2, 1), nn.BatchNorm2d(32), nn.ReLU(),
            nn.ConvTranspose2d(32, 1, 4, 2, 1), nn.Sigmoid()
        )
    
    def encode(self, x):
        h = self.enc(x)
        return self.fc_mu(h), self.fc_var(h)
    
    def reparameterize(self, mu, logvar):
        std = torch.exp(0.5 * logvar)
        return mu + torch.randn_like(std) * std
    
    def decode(self, z):
        h = self.fc_dec(z).view(-1, 256, self.dec_h, self.dec_w)
        out = self.dec(h)
        return nn.functional.interpolate(out, (self.h, self.w), mode='bilinear', align_corners=False)
    
    def forward(self, x):
        mu, logvar = self.encode(x)
        z = self.reparameterize(mu, logvar)
        return self.decode(z), mu, logvar


# ============================================
# LOAD MODEL
# ============================================
def load_model(repo_id="liladhii/meowVAE03-335K", filename="meowVAE03-335K.pth"):
    device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
    
    # Download checkpoint
    checkpoint_path = hf_hub_download(repo_id=repo_id, filename=filename)
    checkpoint = torch.load(checkpoint_path, map_location=device)
    
    # Get config
    config = checkpoint.get('config', {
        'latent_dim': 128, 'n_mels': 64, 'n_fft': 1024,
        'hop_length': 256, 'sample_rate': 22050, 'h': 64, 'w': 87
    })
    
    # Create and load model
    model = MeowVAE(config['h'], config['w'], config['latent_dim']).to(device)
    model.load_state_dict(checkpoint['model_state_dict'])
    model.eval()
    
    return model, config, checkpoint.get('mel_min', -80), checkpoint.get('mel_max', 0), device


# ============================================
# GENERATE MEOWS
# ============================================
def mel_to_audio(mel_db, config):
    """Convert mel spectrogram to audio"""
    mel = librosa.db_to_power(mel_db)
    audio = librosa.feature.inverse.mel_to_audio(
        mel, sr=config['sample_rate'], 
        n_fft=config['n_fft'], 
        hop_length=config['hop_length']
    )
    return librosa.util.normalize(audio)


def generate_meow(model, config, mel_min, mel_max, device, temperature=0.8):
    """Generate a single meow"""
    with torch.no_grad():
        z = torch.randn(1, config['latent_dim']).to(device) * temperature
        mel_norm = model.decode(z).squeeze().cpu().numpy()
        mel_db = mel_norm * (mel_max - mel_min) + mel_min
        audio = mel_to_audio(mel_db, config)
    return audio


def generate_interpolation(model, config, mel_min, mel_max, device, steps=7, temperature=0.8):
    """Generate interpolation between two random points"""
    audios = []
    with torch.no_grad():
        z1 = torch.randn(1, config['latent_dim']).to(device) * temperature
        z2 = torch.randn(1, config['latent_dim']).to(device) * temperature
        
        for alpha in np.linspace(0, 1, steps):
            z = z1 * (1 - alpha) + z2 * alpha
            mel_norm = model.decode(z).squeeze().cpu().numpy()
            mel_db = mel_norm * (mel_max - mel_min) + mel_min
            audios.append(mel_to_audio(mel_db, config))
    
    return np.concatenate(audios)


# ============================================
# EXAMPLE USAGE
# ============================================
if __name__ == "__main__":
    # Load model
    model, config, mel_min, mel_max, device = load_model()
    
    # Generate random meows
    for i in range(5):
        audio = generate_meow(model, config, mel_min, mel_max, device, temperature=0.8)
        sf.write(f'meow_{i+1}.wav', audio, config['sample_rate'])
        print(f"Generated meow_{i+1}.wav")
    
    # Generate interpolation
    interp = generate_interpolation(model, config, mel_min, mel_max, device)
    sf.write('meow_interpolation.wav', interp, config['sample_rate'])
    print("Generated meow_interpolation.wav")

πŸŽ›οΈ Generation Parameters

Temperature

Control the randomness/variety of generated sounds:

Temperature Effect Use Case
0.3 - 0.5 Conservative, similar meows Consistent output
0.6 - 0.8 Balanced variety Recommended
0.9 - 1.2 More variety Creative exploration
1.3+ Wild, experimental Sound design

Examples at Different Temperatures

# Conservative - similar to training data
audio_low = generate_meow(model, config, mel_min, mel_max, device, temperature=0.4)

# Balanced - recommended
audio_mid = generate_meow(model, config, mel_min, mel_max, device, temperature=0.8)

# Creative - more variety
audio_high = generate_meow(model, config, mel_min, mel_max, device, temperature=1.2)

πŸ“Š Model Details

Architecture

Component Details
Type Variational Autoencoder (VAE)
Encoder 4-layer CNN with BatchNorm + LeakyReLU
Decoder 4-layer Transposed CNN with BatchNorm + ReLU
Latent Dimension 128
Parameters ~2.5M

Audio Configuration

Parameter Value
Sample Rate 22,050 Hz
Segment Length 1.0 second
N_FFT 1024
Hop Length 256
N_Mels 64
Mel Spectrogram Shape 64 Γ— 87

Training Details

Parameter Value
Dataset liladhii/cat-meow-sounds
Optimizer Adam
Learning Rate 0.0005
Scheduler CosineAnnealingWarmRestarts
Batch Size 32
Loss MSE Reconstruction + Ξ²-KL Divergence
Ξ² (KL weight) 0.0001

Checkpoint Information

Checkpoint Epoch Loss File Size
meowVAE03-335K.pth 300 TBD ~38 MB

πŸ”§ Advanced Usage

Generate Variations of a Base Sound

def generate_variations(model, config, mel_min, mel_max, device, 
                        num_variations=5, variation_strength=0.3):
    """Generate variations around a base latent point"""
    base_z = torch.randn(1, config['latent_dim']).to(device) * 0.8
    
    audios = []
    with torch.no_grad():
        for i in range(num_variations):
            z = base_z + torch.randn_like(base_z) * variation_strength
            mel_norm = model.decode(z).squeeze().cpu().numpy()
            mel_db = mel_norm * (mel_max - mel_min) + mel_min
            audios.append(mel_to_audio(mel_db, config))
    
    return audios

Generate Long Continuous Sequence

def generate_long_sequence(model, config, mel_min, mel_max, device,
                           duration_seconds=30, temperature=0.8):
    """Generate extended meow sequence with smooth transitions"""
    segment_duration = 1.0
    num_segments = int(duration_seconds / segment_duration) + 1
    
    # Create keypoints in latent space
    num_keypoints = num_segments // 3 + 2
    keypoints = [torch.randn(1, config['latent_dim']).to(device) * temperature 
                 for _ in range(num_keypoints)]
    
    audios = []
    with torch.no_grad():
        for i in range(num_segments):
            # Interpolate between keypoints
            t = i / (num_segments - 1) * (len(keypoints) - 1)
            idx = int(t)
            alpha = t - idx
            idx2 = min(idx + 1, len(keypoints) - 1)
            
            z = keypoints[idx] * (1 - alpha) + keypoints[idx2] * alpha
            mel_norm = model.decode(z).squeeze().cpu().numpy()
            mel_db = mel_norm * (mel_max - mel_min) + mel_min
            audios.append(mel_to_audio(mel_db, config))
    
    # Concatenate with crossfade
    return np.concatenate(audios)[:int(duration_seconds * config['sample_rate'])]

Latent Space Exploration

def explore_latent_dimension(model, config, mel_min, mel_max, device,
                             dimension=0, num_steps=10):
    """Explore a single latent dimension"""
    base_z = torch.zeros(1, config['latent_dim']).to(device)
    
    audios = []
    with torch.no_grad():
        for val in np.linspace(-2, 2, num_steps):
            z = base_z.clone()
            z[0, dimension] = val
            mel_norm = model.decode(z).squeeze().cpu().numpy()
            mel_db = mel_norm * (mel_max - mel_min) + mel_min
            audios.append(mel_to_audio(mel_db, config))
    
    return audios

⚠️ Limitations

  • Duration: Generated clips are ~1 second each
  • Variety: Limited to meow-like sounds (trained only on cat meows)
  • Quality: Some generated samples may have artifacts
  • Pitch Range: May not capture extremely high or low pitched meows

πŸš€ Future Improvements

  • Train for more epochs
  • Implement progressive growing for higher quality
  • Web demo with Gradio

πŸ“ Citation

If you use this model, please cite:

@misc{cat-meow-generator-2026,
  author = {liladhiee},
  title = {Cat Meow AI Generator},
  year = {2026},
  publisher = {HuggingFace},
  url = {https://huggingface.co/liladhii/meowVAE03-335K}
}

πŸ™ Acknowledgments


πŸ“„ License

This model is released under the MIT License.


Made with 🐱 and ❀️

⬆ Back to Top

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support