serverless-modal
यह क्या करती है
यह स्किल Modal, एक serverless क्लाउड सेवा, पर GPU कोड चलाती है। यह उन लोगों के लिए है जिन्हें सर्वर सेट किए बिना GPU कंप्यूट चाहिए, जैसे CUDA कोड डीबग करना या छोटे प्रयोग चलाना।
कब इस्तेमाल करें
- ✓जब आपको ट्रेनिंग, फ़ाइन-ट्यूनिंग या inference के लिए GPU चाहिए और आपके पास लोकल GPU नहीं है।
- ✓जब आप CUDA कोड डीबग करना चाहते हों या सर्वर सेट किए बिना एक छोटा टेस्ट चलाना चाहते हों।
- ✓जब आप चाहते हों कि कोड खत्म होते ही बिलिंग अपने-आप रुक जाए।
Skill का लिंक
https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/blob/main/skills/serverless-modal/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मुझे एक छोटे मॉडल को फ़ाइन-ट्यून करने के लिए GPU चाहिए, और मैं उसे बिना सर्वर सेट किए Modal पर चलाना चाहता हूँ।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट एक छोटी Python फ़ाइल लिखता है जो एनवायरनमेंट और GPU फ़ंक्शन घोषित करती है, फिर उसे Modal कमांड-लाइन से चलाता है। आपका कोड और नतीजे आपके कंप्यूटर पर रहते हैं, और केवल GPU फ़ंक्शन दूर चलता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Modal Cloud GPU — Training & Inference
Task: $ARGUMENTS
Overview
Modal is a serverless GPU cloud. Key advantages over SSH-based platforms (vast.ai, remote servers):
- Zero config: no SSH, no Docker, no port forwarding. Write Python →
modal run→ done. - Auto scale-to-zero: billing stops the instant your code finishes. No idle instances.
- Local-first: run
modal runfrom your laptop. Code, data, and results stay local; only the GPU function runs remotely. - Reproducible environments: dependencies declared in code via
modal.Image, not system-level packages. Treat themodal.Imagechain as the RENDERED form of the declarative env spec in../shared-references/compute-env-contract.md— same spec fields (base, ordered pip phases, env vars, smoke probes), sameenv:<name>@<specHash>ledger entry in.aris/compute/modal.md, same three-tier validation before a long run.
Best for: Users without a local GPU who need to debug CUDA code, run small-scale tests, or iterate quickly on experiments. The $5 free tier (no card) is enough for code debugging; $30 (with card) covers most small-scale experiment runs.
Trade-off: Modal costs more per GPU-hour than vast.ai or Lightning for some GPU tiers, but eliminates setup time and idle billing, often making it cheaper for short/medium workloads. For long training runs (>4 hours), consider vast.ai for lower $/hr.
Authentication
pip install modal
modal setup # Opens browser login, writes token to ~/.modal.toml
# Verify:
modal run -q 'print("ok")'
- Sign up: https://modal.com (GitHub/Google login)
- Free (no card): $5/month — enough for quick tests
- Free (with card): $30/month — bind a payment method at https://modal.com/settings for the full free tier. Set a workspace spending limit to prevent accidental overcharge (Settings → Usage → Spending Limit)
- Academic: apply for $10k credits | Startups: apply for $25k credits
- Secrets:
modal secret create huggingface-secret HF_TOKEN=hf_xxxxx
Recommended setup: Bind a card to unlock $30/month, then immediately set a spending limit (e.g., $30) so you never exceed the free tier. Modal will pause your workloads when the limit is hit.
SECURITY WARNING: Always bind your card and set spending limits directly on https://modal.com/settings in your browser. NEVER enter payment information, card numbers, or billing details through Claude Code or any CLI tool. Only the official Modal website is safe for payment operations.
Pricing (source: modal.com/pricing, per-second billing)
| GPU | $/sec | ≈$/hr | VRAM | Bandwidth GB/s | Free budget → hours |
|---|---|---|---|---|---|
| T4 | $0.000164 | $0.59 | 16GB | 300 | ~8.5 hr ($5) / 50.8 hr ($30) |
| L4 | $0.000222 | $0.80 | 24GB | 300 | ~6.3 hr / 37.5 hr |
| A10 | $0.000306 | $1.10 | 24GB | 600 | ~4.5 hr / 27.3 hr |
| L40S | $0.000542 | $1.95 | 48GB | 864 | ~2.6 hr / 15.4 hr |
| A100-40GB | $0.000583 | $2.10 | 40GB | 1555 | ~2.4 hr / 14.3 hr |
| A100-80GB | $0.000694 | $2.50 | 80GB | 2039 | ~2.0 hr / 12.0 hr |
| H100 | $0.001097 | $3.95 | 80GB | 3352 | ~1.3 hr / 7.6 hr |
| H200 | $0.001261 | $4.54 | 141GB | 4800 | ~1.1 hr / 6.6 hr |
| B200 | $0.001736 | $6.25 | 192GB | 8000 | ~0.8 hr / 4.8 hr |
CPU: $0.047/core/hr | RAM: $0.008/GiB/hr (GPU typically 90%+ of total cost)
!! Cost Estimation Required !!
Before EVERY run, estimate cost and show to user for confirmation.
Key insights:
- Inference bottleneck is memory bandwidth, not compute → high-bandwidth GPUs are often cheaper overall
- 7-8B BF16 inference needs ~22GB VRAM (weights 15G + KV cache 1G + overhead), T4 (16GB) insufficient
- H100 is often cheaper than L4 for benchmarks (11x faster but only 5x more expensive)
Cost Estimation Template (required before every run)
Cost estimate (Modal):
Model: [name] ([params], [precision])
VRAM: ~[X]GB (weights + KV cache + overhead)
GPU: [type] ([VRAM]GB, $[X]/sec = $[X]/hr, bandwidth [X] GB/s)
Estimate: ~[N] min, ~$[X]
7-8B BF16 Benchmark Cost Comparison
| GPU | Speed tok/s | $/hr | 1000 samples x 200tok cost | Duration |
|---|---|---|---|---|
| H100 | 224 | $3.95 | $0.98 | 15 min |
| A100-40GB | 104 | $2.10 | $1.12 | 32 min |
| L4 | 20 | $0.80 | $2.22 | 167 min |
Workflow
Step 1: Analyze Task → Estimate Cost → Choose GPU
Same analysis as any GPU skill — determine VRAM needs from model size, pick GPU, estimate hours, calculate cost. See
अक्सर पूछे जाने वाले सवाल
क्या मुझे SSH या Docker चाहिए?
नहीं। स्किल कहती है कि Modal को न SSH चाहिए और न Docker सेटअप।
इसकी लागत कितनी है?
स्किल एक छोटे मुफ़्त टियर और कार्ड से बड़ी राशि का ज़िक्र करती है। मौजूदा कीमतों के लिए Modal की अपनी साइट देखें।
Modal कब सबसे अच्छा विकल्प नहीं है?
लगभग चार घंटे से लंबे ट्रेनिंग रन के लिए स्किल Vast.ai पर विचार करने का सुझाव देती है।
जानकारी
लेखक का मूल विवरण
Run GPU workloads on Modal — training, fine-tuning, inference, batch processing. Zero-config serverless: no SSH, no Docker, auto scale-to-zero. Use when user says \"modal run\", \"modal training\", \"modal inference\", \"deploy to modal\", \"need a GPU\", \"run on modal\", \"serverless GPU\", or needs remote GPU compute.
लोकप्रियता
- GitHub स्टार
- 18k
- रैंकिंग में स्थान
- #10591
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
ablation-planner
18kआपके एजेंट को किसी शोधपत्र के लिए ablation अध्ययन की योजना बनाने में मदद करती है, मुख्य परिणाम अच्छे दिखने पर समीक्षकों द्वारा माँगे जाने वाले परीक्षण चुनते हुए।
alphaxiv
18kआपके एजेंट को AlphaXiv सार से एक शोधपत्र जल्दी पढ़ने देती है, पूरे पाठ या LaTeX स्रोत को बैकअप के रूप में रखकर, arXiv लिंक या ID से।
analyze-results
18kआपके एजेंट को मशीन लर्निंग प्रयोगों के परिणामों का विश्लेषण करने देती है, रनों की तुलना आधार रेखा से करती है, और आँकड़ों को स्पष्ट निष्कर्षों और अगले कदमों में बदलती है।
arxiv
18kआपके एजेंट को arXiv पर शैक्षणिक शोधपत्र खोजने, उनका विवरण पढ़ने, और किसी शोध विषय के लिए PDF आपकी लाइब्रेरी में सहेजने देती है।
मिलती-जुलती skills
openclaw-update
394kयह आपके एजेंट को चल रहे OpenClaw Gateway को अपडेट करने में मदद करती है, इंस्टॉल के तरीके के अनुसार सही विधि चुनकर और सेशन बनाए रखकर।
diagnose-gateway
394kयह आपके एजेंट को सेटिंग्स, चैनल और पोर्ट जांचकर पता लगाने देती है कि OpenClaw Gateway क्यों फ़ेल हो रहा है, बिना कुछ बदले।
crabbox-apps
394kयह आपके एजेंट को किसी अस्थायी क्लाउड मशीन पर ऐप खोलने और चलाने देती है, फिर उसका व्यू आपके चैट के साइड पैनल में दिखाती है।