본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)51k · #3499

modal

하는 일

Modal은 특히 AI와 머신러닝 작업을 위해, 서버를 직접 관리하지 않고도 강력한 컴퓨터(GPU 포함)를 사용해 Python 코드를 실행하게 해 주는 클라우드 플랫폼입니다.

사용하는 경우

  • ✓강력한 GPU로 AI 모델을 학습하거나 실행해야 할 때.
  • ✓웹사이트나 앱처럼 요청에 응답하는 온라인 서비스를 만들 때.
  • ✓정기적으로 실행해야 하는 반복 작업을 클라우드에서 자동화할 때.

스킬 링크

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/modal/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/modal/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Nvidia H100 GPU로 영화 추천 AI 모델을 학습하고, 결과를 영구 저장소에 저장하고 싶습니다.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

Python 코드를 작성하고 Modal의 도구를 사용해 필요한 자원(GPU나 저장소)을 지정합니다. Modal은 필요에 따라 자동으로 확장하면서 클라우드 서버에서 코드를 실행하는 작업을 처리합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Modal

Overview

Modal is a cloud platform for running Python code serverlessly, with a focus on AI/ML workloads. Key capabilities:

  • GPU compute on demand (including H100, H200, B200 and B300)
  • Serverless functions with autoscaling from zero to thousands of containers
  • Custom container images built entirely in Python code
  • Persistent storage via Volumes for model weights and datasets
  • Web endpoints for serving models and APIs
  • Scheduled jobs via cron or fixed intervals
  • Container reuse and warm pools to reduce cold starts (model loading still takes time)

Modal Apps and Images are defined in Python; existing Dockerfiles are also supported.

When to Use This Skill

Use this skill when:

  • Deploy or serve AI/ML models in the cloud
  • Run GPU-accelerated computations (training, inference, fine-tuning)
  • Create serverless web APIs or endpoints
  • Scale batch processing jobs in parallel
  • Schedule recurring tasks (data pipelines, retraining, scraping)
  • Need persistent cloud storage for model weights or datasets
  • Want to run code in custom container environments
  • Build job queues or async task processing systems

Installation and Authentication

Install

uv pip install "modal==1.6.0"

Reviewed against SDK 1.6.0 and current release notes. Local SDK construction and selected handlers were tested; remote builds, deployments, GPU inference and cloud limits were not executed. Snippets using model/data placeholders or third-party workloads are illustrative and require their stated dependencies.

Authenticate

Prefer existing credentials before creating new ones. Only the two Modal-specific variables below are relevant — do not read, load, or expose any other environment variables or .env file contents:

  1. Reuse an existing Modal profile, or check whether both MODAL_TOKEN_ID and MODAL_TOKEN_SECRET are set; report presence only.
  2. If not, look up only those two keys in a local .env file (ignore all other entries) and load them if appropriate for the workflow.
  3. Only fall back to interactive modal setup if no usable profile or token pair exists. The SDK supports profiles in .modal.toml; environment tokens are optional when a profile authenticates.
modal setup

This opens a browser for authentication. For CI/CD or headless environments, use environment variables:

export MODAL_TOKEN_ID=<your-token-id>
export MODAL_TOKEN_SECRET=<your-token-secret>

If neither an existing profile nor a token pair is available, create credentials at https://modal.com/settings

Check current pricing and workspace quotas before sizing a run. GPU use requires a payment method even when credits remain.

Reference: See references/getting-started.md for detailed setup and first app walkthrough.

Core Concepts

App and Functions

A Modal App groups related functions. Functions decorated with @app.function() run remotely in the cloud:

import modal

app = modal.App("my-app")

@app.function()
def square(x):
    return x ** 2

@app.local_entrypoint()
def main():
    # .remote() runs in the cloud
    print(square.remote(42))

Run with modal run script.py. Deploy with modal deploy script.py.

Reference: See references/functions.md for lifecycle hooks, classes, .map(), .spawn(), and more.

Container Images

Modal builds container images from Python code. The recommended package installer is uv:

image = (
    modal.Image.debian_slim(python_version="3.11")
    .uv_pip_install("torch==2.12.0", "transformers==5.9.0", "accelerate==1.13.0")
    .apt_install("git")
)

@app.function(image=image, gpu="L40S")
def inference(prompt):
    from transformers import pipeline
    pipe = pipeline("text-generation", model="openai-community/gpt2", device=0)
    return pipe(prompt)

Key image methods:

  • .uv_pip_install() — Install Python packages with uv (recommended)
  • .pip_install() — Install with pip (fallback)
  • .apt_install() — Install system packages
  • .run_commands() — Run shell commands during build
  • .run_function() — Run Python during build (e.g., download model weights)
  • .add_local_python_source() — Add local modules
  • .env() — Set environment variables

Reference: See references/images.md for Dockerfiles, micromamba, caching, GPU build steps.

GPU Compute

Request GPUs via the gpu parameter:


…
자주 묻는 질문

Modal은 어떻게 설정하나요?

`uv pip install "modal==1.6.0"`으로 설치한 뒤, 터미널에서 `modal setup`으로 인증합니다. 브라우저가 열리거나, 토큰으로 환경 변수를 설정하는 방식도 있습니다.

‘서버리스 함수’란 무엇인가요?

필요할 때 Modal이 클라우드에서 실행하는 코드 조각입니다. 서버를 켜고 끄는 일을 신경 쓸 필요 없이, 코드가 실행될 때 Modal이 자동으로 처리합니다.

직접 만든 Docker 컨테이너를 쓸 수 있나요?

네, Modal에서는 자신의 Docker 컨테이너를 사용하거나 Python 코드로 직접 새로 만들 수 있어, 애플리케이션의 실행 환경을 쉽게 구성할 수 있습니다.

상세 정보

작성자의 원본 설명

Modal is a serverless cloud platform for running Python on demand, including on-demand GPUs. Use when deploying or serving AI/ML models, running GPU-accelerated workloads (training, fine-tuning, inference), serving web endpoints, scheduling batch jobs, or scaling Python code to cloud containers with the Modal SDK.

repo: K-Dense-AI/scientific-agent-skills

인기도

GitHub 스타
51k
순위
#3499
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬