Second-Me/lpm_kernel/L2
2025-07-01 14:42:25 +08:00
..
data_pipeline shades and topic 2025-07-01 14:42:25 +08:00
dpo Feature/dpo support (#220) 2025-04-14 15:18:42 +08:00
gguf-py Feature/cloud upgrade (#388) 2025-06-23 14:21:23 +08:00
mlx_training Feature/mlx training support new (#131) 2025-04-01 10:31:09 +08:00
__init__.py Initial commit 2025-03-20 00:37:54 +08:00
convert_hf_to_gguf.py Feature/cloud upgrade (#388) 2025-06-23 14:21:23 +08:00
convert_model_to_gguf.sh Initial commit 2025-03-20 00:37:54 +08:00
convert_to_single_line.py fix/DockerWindowsCommandLineError (#138) 2025-04-02 11:47:46 +08:00
data.py new data pipiline 2025-06-27 16:18:54 +08:00
download_model.sh Added CUDA support (#228) 2025-04-25 10:20:36 +08:00
l2_generator.py new data pipiline 2025-06-27 16:18:54 +08:00
memory_manager.py Added CUDA support (#228) 2025-04-25 10:20:36 +08:00
merge_lora_weights.py Added CUDA support (#228) 2025-04-25 10:20:36 +08:00
merge_weights_for_user.sh fix/DockerWindowsCommandLineError (#138) 2025-04-02 11:47:46 +08:00
note_templates.py Initial commit 2025-03-20 00:37:54 +08:00
README.md feat: support LongCoT mode for DeepSeek-R1 data synthesis and model training (#126) 2025-04-07 10:11:23 +08:00
train.py Feature/cloud upgrade (#388) 2025-06-23 14:21:23 +08:00
train_for_user.sh feat: up max seq length 2025-04-27 11:59:16 +08:00
training_prompt.py Initial commit 2025-03-20 00:37:54 +08:00
utils.py Feature/cloud upgrade (#388) 2025-06-23 14:21:23 +08:00

Long Chain-of-Thought (CoT) Feature Implementation

Overview

This implementation adds Long Chain-of-Thought (CoT) capability to the data synthesis pipeline when using DeepSeek R1 as the base model. The feature enables multi-step reasoning for enhanced context-aware responses.

Feature Description

  • Long CoT Mode: When enabled, the system generates synthetic data with extended reasoning chains

  • DeepSeek R1 Integration: Exclusive use of DeepSeek-R1 model for CoT data generation

  • Enhanced Training: Produces models with improved long-context reasoning capabilities

Implementation Details

Configuration Options

  1. Backend Configuration:

    • Set is_cot=True in trainprocess_service.py initialization

    • Configure via train_for_user.sh with --is_cot True/False

    • Environment variables in lpm_kernel/L2/.env:

        DEEPSEEK_MODEL_NAME=deepseek-*
    
        DEEPSEEK_API_KEY=your_api_key
    
        DEEPSEEK_BASE_URL=your_base_url
    

Data Synthesis Pipeline

  1. Supported Data Types:

    • SelfQA data

    • Preference data

    • Diversity data

  2. Prompt Structure:

	<think>reasoning_content</think>
    <answer>final_content</answer>
  1. Model Whitelisting:

    • Only DeepSeek-R1 is allowed for CoT data generation

Code Changes

  1. Modified Files:

    • selfqa.py:

      • Added is_cot initialization option

      • Updated prompt templates

      • Modified response handling

    • preference_QA_generate.py:

      • Added CoT support

      • Enhanced question extraction

    • diversity_data_generator.py:

      • Added CoT templates

      • Updated generation logic

  2. New Functions:

    • Unified get_remote_response() function

    • Enhanced logging with tqdm integration