File size: 1,218 Bytes
8a8c3b9
 
 
 
 
 
 
 
cd7ff22
 
8a8c3b9
cd7ff22
8a8c3b9
cd7ff22
8a8c3b9
 
cd7ff22
8a8c3b9
cd7ff22
 
 
 
 
 
 
8a8c3b9
 
 
 
cd7ff22
 
8a8c3b9
cd7ff22
 
8a8c3b9
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
Pre-download emotion2vec+ Large model for Docker build
This bakes the model into the image so it doesn't download at runtime.
"""
import os
import sys

# Set cache directories
# Set cache directories
CACHE_DIR = '/data/huggingface'
os.makedirs(CACHE_DIR, exist_ok=True)
os.environ['HF_HOME'] = CACHE_DIR

print(f"⬇️  Downloading emotion2vec+ Large from Hugging Face to {CACHE_DIR}...")

try:
    from huggingface_hub import snapshot_download
    
    # Download emotion2vec+ Large from HF
    # Using the official model ID: emotion2vec/emotion2vec_plus_large
    model_dir = snapshot_download(
        repo_id='emotion2vec/emotion2vec_plus_large',
        cache_dir=CACHE_DIR,
        revision='main'
    )
    
    print(f"✅ Model downloaded to: {model_dir}")
    
    # Verify file existence
    if os.path.exists(os.path.join(model_dir, 'model.pt')) or os.path.exists(os.path.join(model_dir, 'model.bin')):
        print("✅ Validation: Model file exists")
    else:
        print("❌ Validation failed: Model file missing")
        # sys.exit(1) # Don't fail build if file structure is different, just warn
        
except Exception as e:
    print(f"❌ Error downloading model: {e}")
    sys.exit(1)