AA
LLM Model Training
This repository contains the code for training a simple LLM model using PyTorch.
Requirements
- Python 3.7 or higher
- PyTorch 1.9.0 or higher
Installation
- Clone this repository.
- Install the required dependencies by running
pip install -r requirements.txt
.
Running the Model
- Update the
main.py
file with your desired input size, output size, and initial state for the Game class. - Run the
main.py
file:python main.py
. This will train the LLM model and save it assaved_model.pt
.
Loading the Trained Model
- Initialize an LLM model with the appropriate input and output sizes.
- Load the saved model's state dictionary using
llm.load_state_dict(torch.load("./saved_model.pt"))
.
###< saved_model: The saved_model.pt file is generated when you save the trained LLM model using torch.save(llm.state_dict(), "./saved_model.pt"). You don't need to create this file manually; it will be created when you run the training script (main.py).
l Step by step guide on how to run the model from GitHub:
Clone the GitHub repository to your local machine: git clone xxx
Change into the repository's directory: bash cc: cd your_repository Install the required dependencies:
cc: pip install -r requirements.txt Update the main.py file with your desired input size, output size, and initial state for the Game class. Run the training script:
css cc: python main.py This will train the LLM model and save it as saved_model.pt.
To load and use the trained model in another script or project, follow these steps: a. Initialize an LLM model with the appropriate input and output sizes.
b. Load the saved model's state dictionary:
python cc: llm.load_state_dict(torch.load("./saved_model.pt")) Now you can use the trained model for making predictions or further fine-tuning.