Skip to main content

Utilities for LLM system research and development.

Project description

sflaunch

Utilities for LLM system research and development.

Installation

pip install sflaunch

sfmegarun

sfmegarun launches a distributed Megatron-LM training job across multiple nodes over SSH. It renders a torchrun launch script, saves it alongside a config snapshot to a timestamped output directory, then SSHes into each node to execute it.

Usage

sfmegarun --cluster cluster.yaml --pretrain megatron.yaml
Flag Short Default Description
--cluster -c required Path to cluster config YAML
--pretrain -p, -m required Path to Megatron-LM job config YAML
--port 29500 Master node port for distributed communication
--nnodes cluster default Override number of nodes (must not exceed nodes in cluster config)
--nproc-per-node cluster default Override GPUs per node
--tmux / --no-tmux --tmux Open each rank in a tmux window (requires an active tmux session)
--log-level INFO Logging level

When --tmux is active and a tmux session is detected, each node rank is launched in a separate tmux window named rank-<N>. Otherwise, each rank is launched as a subprocess.

Cluster config

# cluster.yaml
nodes:
  - ip_addr: 10.0.0.1
    ssh_target: node1      # defaults to ip_addr if omitted
    num_gpus: 8            # default: 8
  - ip_addr: 10.0.0.2
    ssh_target: node2
    num_gpus: 8

working_dir: /path/to/working/dir   # must exist on each node
script: /path/to/train_script.py    # path to the Megatron training script
output_dir: /path/to/output         # base dir for logs and run artifacts
env_setup: "source /path/to/venv/bin/activate"  # optional

Megatron job config

# megatron.yaml
name: my-pretrain-job

env:
  CUDA_DEVICE_MAX_CONNECTIONS: "1"
  NCCL_DEBUG: "INFO"

argv:
  - --num-layers="32"
  - --hidden-size="4096"
  # ... other Megatron-LM arguments

Output

Each run creates a directory at <output_dir>/<job_name>/<date>/<timestamp>/ containing:

  • config.yaml - snapshot of the cluster and job configs used
  • run.sh - the generated torchrun launch script
  • node-<rank>.log - stdout/stderr from each node (written on the node)

Miscellaneous

Generating JSON schemas

To get JSON schemas for the config files (useful for editor validation):

python scripts/generate_schemas.py --output <dir>

This writes cluster.schema.json and megatron-job.schema.json to the specified directory. You can then reference these in your editor for YAML validation and autocompletion.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sflaunch-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sflaunch-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file sflaunch-0.1.0.tar.gz.

File metadata

  • Download URL: sflaunch-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sflaunch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff5640dee0359d07feaa698f4efbd5ca68fbef6e260365427d9485b5d05f96ad
MD5 bd8346c2179d0f63eb1f0029d4614721
BLAKE2b-256 8403f9e3373c80e9fcd40a7a79e1fa0c40c363f51bfee81786613939652475ed

See more details on using hashes here.

File details

Details for the file sflaunch-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sflaunch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sflaunch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae8d3eb057d45f3d4c13c5ee45ee7e4605108f9a6e9762daa654250371494ac6
MD5 147c815836979fc664747c28145fb38e
BLAKE2b-256 0ef0aaa4fa329eccb44061f063c89a2554a265d89d7abd7749e5edbe400171c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page