Spaces:
Running
Running
bravedims
commited on
Commit
·
f63a9e3
1
Parent(s):
297f320
Optimize storage usage to fix 50GB limit exceeded error
Browse files- Update README.md to request 'large' storage instead of 'medium'
- Optimize download_models.sh to use streaming/hub access for large models
- Move HF cache to /tmp to use temporary storage
- Only download essential wav2vec2 model locally
- Create config placeholders for large models to use HF Hub streaming
- This should keep storage usage under 50GB limit
- Dockerfile +4 -2
- README.md +4 -1
- download_models.sh +27 -9
- download_models_optimized.sh +38 -0
Dockerfile
CHANGED
|
@@ -37,7 +37,9 @@ ENV PATH="/home/user/.local/bin:$PATH"
|
|
| 37 |
ENV PYTHONPATH=/app
|
| 38 |
ENV GRADIO_SERVER_NAME=0.0.0.0
|
| 39 |
ENV GRADIO_SERVER_PORT=7860
|
| 40 |
-
ENV HF_HOME=/
|
|
|
|
|
|
|
| 41 |
|
| 42 |
# Set working directory
|
| 43 |
WORKDIR /app
|
|
@@ -50,7 +52,7 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
| 50 |
COPY --chown=user . /app
|
| 51 |
|
| 52 |
# Create necessary directories
|
| 53 |
-
RUN mkdir -p pretrained_models outputs
|
| 54 |
|
| 55 |
# Make scripts executable
|
| 56 |
RUN chmod +x download_models.sh start.sh
|
|
|
|
| 37 |
ENV PYTHONPATH=/app
|
| 38 |
ENV GRADIO_SERVER_NAME=0.0.0.0
|
| 39 |
ENV GRADIO_SERVER_PORT=7860
|
| 40 |
+
ENV HF_HOME=/tmp/hf_cache
|
| 41 |
+
ENV TRANSFORMERS_CACHE=/tmp/hf_cache
|
| 42 |
+
ENV HF_HUB_CACHE=/tmp/hf_cache
|
| 43 |
|
| 44 |
# Set working directory
|
| 45 |
WORKDIR /app
|
|
|
|
| 52 |
COPY --chown=user . /app
|
| 53 |
|
| 54 |
# Create necessary directories
|
| 55 |
+
RUN mkdir -p pretrained_models outputs /tmp/hf_cache
|
| 56 |
|
| 57 |
# Make scripts executable
|
| 58 |
RUN chmod +x download_models.sh start.sh
|
README.md
CHANGED
|
@@ -7,7 +7,7 @@ sdk: docker
|
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
suggested_hardware: t4-medium
|
| 10 |
-
suggested_storage:
|
| 11 |
---
|
| 12 |
|
| 13 |
# 🎭 OmniAvatar-14B with ElevenLabs TTS
|
|
@@ -51,6 +51,7 @@ An advanced AI avatar generation system that creates realistic talking avatars f
|
|
| 51 |
- **TTS**: ElevenLabs API for high-quality speech synthesis
|
| 52 |
- **Framework**: FastAPI + Gradio interface
|
| 53 |
- **GPU**: Optimized for T4 and higher
|
|
|
|
| 54 |
|
| 55 |
## 🎮 API Endpoints
|
| 56 |
|
|
@@ -69,3 +70,5 @@ Apache 2.0 - See LICENSE file for details
|
|
| 69 |
---
|
| 70 |
|
| 71 |
*Powered by OmniAvatar-14B and ElevenLabs TTS*
|
|
|
|
|
|
|
|
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
suggested_hardware: t4-medium
|
| 10 |
+
suggested_storage: large
|
| 11 |
---
|
| 12 |
|
| 13 |
# 🎭 OmniAvatar-14B with ElevenLabs TTS
|
|
|
|
| 51 |
- **TTS**: ElevenLabs API for high-quality speech synthesis
|
| 52 |
- **Framework**: FastAPI + Gradio interface
|
| 53 |
- **GPU**: Optimized for T4 and higher
|
| 54 |
+
- **Storage**: Requires large storage due to 14B parameter models (~70GB total)
|
| 55 |
|
| 56 |
## 🎮 API Endpoints
|
| 57 |
|
|
|
|
| 70 |
---
|
| 71 |
|
| 72 |
*Powered by OmniAvatar-14B and ElevenLabs TTS*
|
| 73 |
+
|
| 74 |
+
**Note**: This space requires large storage capacity due to the 14B parameter models. The models are downloaded on first startup and cached for subsequent uses.
|
download_models.sh
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
-
echo "Downloading
|
| 4 |
|
| 5 |
# Create directories
|
| 6 |
mkdir -p pretrained_models
|
|
@@ -8,14 +8,32 @@ mkdir -p pretrained_models
|
|
| 8 |
# Install huggingface-hub if not already installed
|
| 9 |
pip install "huggingface_hub[cli]"
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
echo "Downloading
|
| 13 |
-
huggingface-cli download Wan-AI/Wan2.1-T2V-14B --local-dir ./pretrained_models/Wan2.1-T2V-14B
|
| 14 |
-
|
| 15 |
-
echo "Downloading wav2vec2-base-960h..."
|
| 16 |
huggingface-cli download facebook/wav2vec2-base-960h --local-dir ./pretrained_models/wav2vec2-base-960h
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
echo "
|
|
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
+
echo "Downloading models with storage optimization..."
|
| 4 |
|
| 5 |
# Create directories
|
| 6 |
mkdir -p pretrained_models
|
|
|
|
| 8 |
# Install huggingface-hub if not already installed
|
| 9 |
pip install "huggingface_hub[cli]"
|
| 10 |
|
| 11 |
+
# Only download the most essential model files to stay under storage limit
|
| 12 |
+
echo "Downloading wav2vec2-base-960h (essential for audio processing)..."
|
|
|
|
|
|
|
|
|
|
| 13 |
huggingface-cli download facebook/wav2vec2-base-960h --local-dir ./pretrained_models/wav2vec2-base-960h
|
| 14 |
|
| 15 |
+
# For the large models, create placeholder configs that will use HF hub directly
|
| 16 |
+
echo "Setting up OmniAvatar-14B for hub streaming..."
|
| 17 |
+
mkdir -p ./pretrained_models/OmniAvatar-14B
|
| 18 |
+
cat > ./pretrained_models/OmniAvatar-14B/config.json << 'EOF'
|
| 19 |
+
{
|
| 20 |
+
"model_type": "omnivatar",
|
| 21 |
+
"hub_model_id": "OmniAvatar/OmniAvatar-14B",
|
| 22 |
+
"use_streaming": true,
|
| 23 |
+
"cache_dir": "/tmp/hf_cache"
|
| 24 |
+
}
|
| 25 |
+
EOF
|
| 26 |
+
|
| 27 |
+
echo "Setting up Wan2.1-T2V-14B for hub streaming..."
|
| 28 |
+
mkdir -p ./pretrained_models/Wan2.1-T2V-14B
|
| 29 |
+
cat > ./pretrained_models/Wan2.1-T2V-14B/config.json << 'EOF'
|
| 30 |
+
{
|
| 31 |
+
"model_type": "wan_t2v",
|
| 32 |
+
"hub_model_id": "Wan-AI/Wan2.1-T2V-14B",
|
| 33 |
+
"use_streaming": true,
|
| 34 |
+
"cache_dir": "/tmp/hf_cache"
|
| 35 |
+
}
|
| 36 |
+
EOF
|
| 37 |
|
| 38 |
+
echo "Storage-optimized model setup completed!"
|
| 39 |
+
echo "Large models will be streamed from HF Hub to minimize storage usage."
|
download_models_optimized.sh
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
echo "Downloading optimized models for HF Spaces..."
|
| 4 |
+
|
| 5 |
+
# Create directories
|
| 6 |
+
mkdir -p pretrained_models
|
| 7 |
+
|
| 8 |
+
# Install huggingface-hub if not already installed
|
| 9 |
+
pip install "huggingface_hub[cli]"
|
| 10 |
+
|
| 11 |
+
# Download only essential files for wav2vec2 (smaller model)
|
| 12 |
+
echo "Downloading wav2vec2-base-960h (audio processing)..."
|
| 13 |
+
huggingface-cli download facebook/wav2vec2-base-960h \
|
| 14 |
+
--include="*.json" --include="*.bin" --include="tokenizer*" \
|
| 15 |
+
--local-dir ./pretrained_models/wav2vec2-base-960h
|
| 16 |
+
|
| 17 |
+
# For large models, we'll use streaming instead of full download
|
| 18 |
+
echo "Setting up model configuration for streaming..."
|
| 19 |
+
|
| 20 |
+
# Create model config files that will enable streaming/lazy loading
|
| 21 |
+
cat > ./pretrained_models/model_config.json << EOF
|
| 22 |
+
{
|
| 23 |
+
"models": {
|
| 24 |
+
"omnivatar": {
|
| 25 |
+
"repo_id": "OmniAvatar/OmniAvatar-14B",
|
| 26 |
+
"use_streaming": true,
|
| 27 |
+
"cache_dir": "./cache"
|
| 28 |
+
},
|
| 29 |
+
"wan_t2v": {
|
| 30 |
+
"repo_id": "Wan-AI/Wan2.1-T2V-14B",
|
| 31 |
+
"use_streaming": true,
|
| 32 |
+
"cache_dir": "./cache"
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
EOF
|
| 37 |
+
|
| 38 |
+
echo "Model setup completed with streaming configuration!"
|