graph LR
P_Tuning_Orchestrator["P-Tuning Orchestrator"]
Core_Fine_tuning_Manager["Core Fine-tuning Manager"]
Training_Workflow_Executor["Training Workflow Executor"]
Iterative_Training_Execution["Iterative Training Execution"]
Model_Evaluation["Model Evaluation"]
Model_Prediction["Model Prediction"]
Model_Persistence["Model Persistence"]
Model_Publishing["Model Publishing"]
P_Tuning_Orchestrator -- "initiates" --> Training_Workflow_Executor
Training_Workflow_Executor -- "delegates to" --> Iterative_Training_Execution
Iterative_Training_Execution -- "triggers" --> Model_Evaluation
Iterative_Training_Execution -- "triggers" --> Model_Persistence
Model_Evaluation -- "shares logic with" --> Model_Prediction
Model_Persistence -- "can trigger" --> Model_Publishing
Core_Fine_tuning_Manager -- "contains method" --> Training_Workflow_Executor
Core_Fine_tuning_Manager -- "contains method" --> Iterative_Training_Execution
Core_Fine_tuning_Manager -- "contains method" --> Model_Evaluation
Core_Fine_tuning_Manager -- "contains method" --> Model_Prediction
Core_Fine_tuning_Manager -- "contains method" --> Model_Persistence
Core_Fine_tuning_Manager -- "contains method" --> Model_Publishing
The P-Tuning Subsystem is a dedicated module within the ChatGLM-6B project, focused entirely on the Parameter-Efficient Fine-Tuning (PEFT) lifecycle using the P-Tuning v2 method. Its boundaries are primarily defined by the ptuning.main and ptuning.trainer modules.
Serves as the primary entry point for the P-Tuning fine-tuning process. It is responsible for initial setup, argument parsing, and orchestrating the overall fine-tuning workflow by initiating the Trainer.
Related Classes/Methods:
This is the central component that encapsulates and manages the entire fine-tuning lifecycle. It handles the initialization of the training environment, configuration of callbacks, and preparation of the model for device placement. It acts as the high-level manager for all training-related operations.
Related Classes/Methods:
Manages the overall training workflow, including loading from checkpoints, executing the core training loop, and handling model initialization. It's the method that kicks off the actual training process.
Related Classes/Methods:
Encapsulates the iterative training process, handling data loading, optimizer/scheduler creation, logging, periodic evaluation, and checkpoint saving. This is the core of the training execution where model parameters are updated.
Related Classes/Methods:
Conducts model evaluation on a validation dataset to assess performance metrics during or after training. It provides insights into the model's generalization capabilities.
Related Classes/Methods:
Performs inference on a test dataset, generating predictions from the fine-tuned model. This method is used to assess the final performance of the model on unseen data.
Related Classes/Methods:
Persists the trained model and its configuration to local storage, ensuring that the fine-tuned model can be reloaded and reused later.
Related Classes/Methods:
Facilitates the publishing of the trained model to an external model hub (e.g., Hugging Face Hub), enabling sharing, versioning, and broader deployment.
Related Classes/Methods: