How leminhbinh0209/deepsick-r1 works
Main Components
• Entrypoint & Environment Setup: The launch process begins with the train.sh script. This script sets the appropriate GPU environment variables (e.g., CUDA_VISIBLE_DEVICES) and uses the Accelerate launcher configured with DeepSpeed (using ds_accel.yaml) to run the training.
• Training Execution: The main.py file acts as the primary training script. It is responsible for orchestrating the training workflow.
• Training Logic: The trainer.py contains the core training routines – encapsulated training loops, model updates and integration with DeepSpeed’s ZeRO3 optimization.
• Utility Functions: The utils.py file supplies helper functions, which might include data handling, logging, metrics, or other auxiliary tasks.
• vLLM Inference Component: Although not a separate file, the repository integrates vLLM (a library for rapid answer generation) by dedicating one GPU solely to inference, while other GPUs focus on training.
• Distributed Training Configuration: The ds_accel.yaml config file is used by DeepSpeed and Accelerate to manage multi-GPU training, ensuring proper distribution and communication between training GPUs and the GPU running vLLM for inference.
Relationships and Interactions
• The train.sh script is the first component executed. It sets up the GPU allocation and then calls the accelerate launcher (with the ds_accel.yaml configuration) to execute main.py.
• Within main.py, the training workflow is initialized. It likely calls on trainer.py for core training functions, while utility functions from utils.py are invoked for supporting tasks (e.g., logging, data transformations).
• The DeepSpeed configuration ensures that the appropriate number of GPUs is used. The separation of one GPU for vLLM and the remaining for training should be clearly illustrated.
• External dependencies such as vLLM and DeepSpeed operate as outsourced libraries supporting inference and distributed training respectively.
Architectural Patterns and Design Principles
• Separation of Concerns: Each file is responsible for a distinct part of the system (script launching, training orchestration, training logic, utilities). This minimal but modular separation makes the codebase very approachable.
• Distributed and Parallel Training: Using Accelerate and DeepSpeed’s ZeRO3 for scaling and distributed training with multiple GPUs is a crucial design choice.
• Inference-Training GPU Isolation: The project explicitly separates the GPU resources for inference (vLLM) and training to avoid cross-interference—a key performance and resource management strategy.
• Including a block (or a note) that explains resource allocation – specifically, how GPUs are partitioned (one for vLLM and remaining for training).