Update document.txt
Browse files- document.txt +138 -103
document.txt
CHANGED
|
@@ -1,103 +1,138 @@
|
|
| 1 |
-
T5-Small Project Guide
|
| 2 |
-
=====================
|
| 3 |
-
|
| 4 |
-
Welcome to the T5-Small Project Guide by RemiAI3, a free educational resource for students to learn AI model fine-tuning using
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
-
|
| 79 |
-
-
|
| 80 |
-
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
T5-Small Project Guide
|
| 2 |
+
=====================
|
| 3 |
+
|
| 4 |
+
Welcome to the T5-Small Project Guide by RemiAI3, a free educational resource for students to learn AI model fine-tuning using
|
| 5 |
+
Hugging Face's T5-small model. This project enables students to build a question-answering system, such as answering questions
|
| 6 |
+
about the Chola Empire, using open-source tools.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
Objective
|
| 11 |
+
---------
|
| 12 |
+
Our goal is to provide accessible AI resources for students to experiment with and learn from, promoting RemiAI3’s mission of
|
| 13 |
+
democratizing AI education. This project is designed to be lightweight, avoiding the high costs of deploying large AI models like
|
| 14 |
+
text-to-image generators.
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
Prerequisites
|
| 19 |
+
-------------
|
| 20 |
+
- Python Version: Python 3.10.9 - MUST USE THIS VERSION ONLY
|
| 21 |
+
- Virtual Environment: Use `venv` to isolate dependencies
|
| 22 |
+
- Hugging Face Account: Sign up at https://huggingface.co to get an access token
|
| 23 |
+
You can grt the access token by
|
| 24 |
+
1. Click on your Profile in the Hugging face
|
| 25 |
+
2. Scroll down to the buttom then you can see a section named as Access Token
|
| 26 |
+
3. Click on it and Enter your Hugging Face Password
|
| 27 |
+
4. Click on the create a new Token
|
| 28 |
+
5. Then you will redirect to the new page at there click on the write access
|
| 29 |
+
6. Click on the create Token if it displaye on the top is ok or then scroll the screen down then there you can a see a button create
|
| 30 |
+
7. Hit the create button then you will get your Hugging Face Token HF-TOKEN
|
| 31 |
+
- Dataset: A CSV or JSON file with question-answer pairs. Example JSON format:
|
| 32 |
+
```json
|
| 33 |
+
[
|
| 34 |
+
{"input": "Who was the founder of the Chola Empire?", "response": "Vijayalaya Chola"},
|
| 35 |
+
{"input": "What was the main military force of the Cholas?", "response": "Well-organized army and navy"},
|
| 36 |
+
{"input": "What was a key administrative reform by the Cholas?", "response": "Efficient land revenue system"}
|
| 37 |
+
]
|
| 38 |
+
```
|
| 39 |
+
CSV format (if used):
|
| 40 |
+
```csv
|
| 41 |
+
input,response
|
| 42 |
+
"Who was the founder of the Chola Empire?","Vijayalaya Chola"
|
| 43 |
+
"What was the main military force of the Cholas?","Well-organized army and navy"
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
Setup Instructions
|
| 49 |
+
------------------
|
| 50 |
+
1. Install Python: Download Python 3.10.9 from https://www.python.org/downloads/.
|
| 51 |
+
2. Clone the Repository:
|
| 52 |
+
```
|
| 53 |
+
git clone https://huggingface.co/remiai3/t5-small-project-guide
|
| 54 |
+
cd t5-small-project-guide
|
| 55 |
+
```
|
| 56 |
+
3. Create and Activate a Virtual Environment:
|
| 57 |
+
```
|
| 58 |
+
python -m venv venv
|
| 59 |
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
| 60 |
+
```
|
| 61 |
+
4. Install Dependencies:
|
| 62 |
+
```
|
| 63 |
+
pip install -r requirements.txt
|
| 64 |
+
```
|
| 65 |
+
5. Prepare Your Dataset: Place your `dataset.csv` or `dataset.json` in the project folder.
|
| 66 |
+
6. Set Hugging Face Token: Open `t5_project_all_in_one.py` and replace "YOUR_HUGGING_FACE_TOKEN" with your Hugging Face token.
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
Running the Project
|
| 71 |
+
------------------
|
| 72 |
+
1. Fine-Tune the Model:
|
| 73 |
+
Run the all-in-one script to convert the dataset (if CSV), preprocess, download the model, and fine-tune:
|
| 74 |
+
```
|
| 75 |
+
python t5_project_all_in_one.py
|
| 76 |
+
```
|
| 77 |
+
This will:
|
| 78 |
+
- Convert CSV to JSON (if needed)
|
| 79 |
+
- Preprocess the dataset
|
| 80 |
+
- Download T5-small weights
|
| 81 |
+
- Fine-tune the model
|
| 82 |
+
- Save the fine-tuned model to `./finetuned_t5`
|
| 83 |
+
- Generate a plot of training and validation loss (`training_metrics.png`)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
Project Files
|
| 88 |
+
------------
|
| 89 |
+
- t5_project_all_in_one.py: Single script for dataset conversion, preprocessing, model downloading, and fine-tuning.
|
| 90 |
+
- requirements.txt: Lists required Python libraries.
|
| 91 |
+
- document.txt: This file with detailed instructions.
|
| 92 |
+
- README.md: Model configuration and repo overview.
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
Libraries and Versions
|
| 97 |
+
----------------------
|
| 98 |
+
- transformers==4.44.2
|
| 99 |
+
- datasets==3.0.1
|
| 100 |
+
- torch==2.4.1
|
| 101 |
+
- pandas==2.2.3
|
| 102 |
+
- matplotlib==3.9.2
|
| 103 |
+
- accelerate==1.0.1
|
| 104 |
+
- huggingface_hub==0.26.0
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
Documentation
|
| 109 |
+
-------------
|
| 110 |
+
- Hugging Face Transformers: https://huggingface.co/docs/transformers
|
| 111 |
+
- Datasets Library: https://huggingface.co/docs/datasets
|
| 112 |
+
- T5 Model: https://huggingface.co/docs/transformers/model_doc/t5
|
| 113 |
+
- Pandas: https://pandas.pydata.org/docs
|
| 114 |
+
- Matplotlib: https://matplotlib.org/stable/contents.html
|
| 115 |
+
- Accelerate: https://huggingface.co/docs/accelerate
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
Troubleshooting
|
| 120 |
+
---------------
|
| 121 |
+
- Inaccurate Answers: Ensure your dataset has 500+ clean question-answer pairs. Increase `num_train_epochs` or `learning_rate` in `t5_project_all_in_one.py`.
|
| 122 |
+
- Token Errors: Verify the Hugging Face token in `t5_project_all_in_one.py` is correct.
|
| 123 |
+
- Library Issues: Reinstall dependencies with `pip install -r requirements.txt`.
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
Contributing
|
| 127 |
+
------------
|
| 128 |
+
Fork the repository, make changes, and submit a pull request at https://huggingface.co/remiai3/t5-small-project-guide.
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
About RemiAI3
|
| 133 |
+
-------------
|
| 134 |
+
RemiAI3 is committed to providing free AI educational resources to empower students. By using this project, you’re helping promote our
|
| 135 |
+
mission to build our brand for future AI innovations.
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
|