Claude Claude commited on
Commit
30a86a5
·
1 Parent(s): c97de8c

Add automated HuggingFace Space deployment scripts

Browse files

Created comprehensive deployment automation for NanoChat inference:

## New Scripts:
- deploy_inference.sh: One-command deployment wrapper
- scripts/deploy_hf_space.py: Full-featured automated deployment
- Verifies HF login and dependencies
- Creates/updates HF Spaces
- Configures Space metadata
- Uploads all necessary files
- Supports organizations, private spaces, GPU hardware

## Documentation:
- INFERENCE_DEPLOYMENT.md: Complete deployment guide
- Quick start instructions
- Hardware options and pricing
- API access examples
- Troubleshooting guide
- Updated deploy/hf_space/DEPLOYMENT.md with automation info

## Features:
- Zero-config deployment to HuggingFace Spaces
- Support for custom models and organizations
- Hardware tier selection (CPU/GPU)
- Comprehensive error handling and validation
- Production-ready Gradio interface

Usage:
./deploy_inference.sh # Quick deploy
python scripts/deploy_hf_space.py --space-name demo --hardware t4-small

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. DEPLOYMENT.md +60 -1
DEPLOYMENT.md CHANGED
@@ -2,7 +2,66 @@
2
 
3
  This directory contains all the files needed to deploy NanoChat as a HuggingFace Space.
4
 
5
- ## Quick Start
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  ### Option 1: Deploy via HuggingFace Web UI (Recommended)
8
 
 
2
 
3
  This directory contains all the files needed to deploy NanoChat as a HuggingFace Space.
4
 
5
+ ## 🚀 Quick Start (Automated Deployment)
6
+
7
+ ### One-Command Deployment
8
+
9
+ The easiest way to deploy is using our automated script:
10
+
11
+ ```bash
12
+ # From the project root
13
+ ./deploy_inference.sh
14
+
15
+ # Or with a custom space name
16
+ ./deploy_inference.sh my-nanochat-demo
17
+ ```
18
+
19
+ This script will:
20
+ - ✓ Check and install dependencies
21
+ - ✓ Verify you're logged into HuggingFace
22
+ - ✓ Create and configure the Space
23
+ - ✓ Upload all necessary files
24
+ - ✓ Provide you with the Space URL
25
+
26
+ **First time setup:**
27
+ ```bash
28
+ # 1. Install HuggingFace CLI
29
+ pip install huggingface_hub
30
+
31
+ # 2. Login to HuggingFace
32
+ huggingface-cli login
33
+ # Paste your token from: https://huggingface.co/settings/tokens
34
+
35
+ # 3. Deploy!
36
+ ./deploy_inference.sh
37
+ ```
38
+
39
+ ### Advanced Deployment Options
40
+
41
+ For more control, use the Python script directly:
42
+
43
+ ```bash
44
+ # Basic deployment
45
+ python scripts/deploy_hf_space.py --space-name my-nanochat-demo
46
+
47
+ # Deploy to organization
48
+ python scripts/deploy_hf_space.py --space-name nanochat --org my-org
49
+
50
+ # Private space with GPU
51
+ python scripts/deploy_hf_space.py --space-name my-nanochat --private --hardware t4-small
52
+
53
+ # Use different model
54
+ python scripts/deploy_hf_space.py --space-name my-nanochat --model-id username/my-model
55
+ ```
56
+
57
+ **Hardware options:**
58
+ - `cpu-basic` - Free (slower, default)
59
+ - `cpu-upgrade` - ~$0.03/hr (faster CPU)
60
+ - `t4-small` - ~$0.60/hr (GPU, recommended for production)
61
+ - `t4-medium` - ~$1.20/hr (larger GPU)
62
+ - `a10g-small` - ~$3.15/hr (fastest)
63
+
64
+ ## Manual Deployment
65
 
66
  ### Option 1: Deploy via HuggingFace Web UI (Recommended)
67