Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Huggingface Open r1 Environment Setup

From Leeroopedia


Field Value
Sources Doc (Python Packaging https://packaging.python.org/en/latest/), Doc (pip install https://pip.pypa.io/en/stable/)
Domains Infrastructure, DevOps
Last Updated 2026-02-08 00:00 GMT

Overview

A dependency management methodology that uses extras-based package installation to configure Python environments for different training and evaluation workflows with pinned dependency versions.

Description

Large ML projects depend on dozens of packages with specific version requirements. This principle addresses reproducible environment setup by:

  1. Using a setup.py with setuptools for package installation.
  2. Organizing dependencies into base requirements and optional extras (dev, quality, tests, eval, code).
  3. Pinning critical dependency versions (trl==0.18.0, transformers==4.52.3, deepspeed==0.16.8, torch==2.6.0) for reproducibility.
  4. Supporting workflow-specific extras (e.g., "code" extra for e2b-code-interpreter, morphcloud; "eval" extra for lighteval).

This allows users to install only what they need: pip install -e '.[dev]' for full development or targeted extras for specific workflows.

Usage

Use as the first step of any workflow to ensure all required packages are installed with compatible versions.

Theoretical Basis

The extras-based installation pattern organizes dependencies into a base set and named groups of optional dependencies. The base set covers core functionality, while each extra targets a specific workflow. A meta-extra ("dev") combines all groups for full development environments. Package managers resolve the combined dependency tree and install pinned versions to guarantee reproducibility.

Pseudocode:

base_deps = [accelerate, datasets, transformers, trl, torch, ...]
extras = {
    "quality": [ruff, isort],
    "tests": [pytest, parameterized],
    "eval": [lighteval, math-verify],
    "code": [e2b-code-interpreter, morphcloud],
    "dev": quality + tests + eval + code
}
install("open-r1", extras=["dev"])  # installs base + all extras

This ensures that:

  • Every workflow has a minimal, well-defined set of dependencies.
  • Critical packages are pinned to exact versions for reproducibility.
  • Users can install only what they need, reducing environment size and conflict risk.
  • The "dev" meta-extra provides a single command for full development setup.

Related Pages

Implementation:Huggingface_Open_r1_Setup_Py_Install

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment