https://github.com/swamikannan/quick_and_dirty-supervised-fine-tuning
https://github.com/swamikannan/quick_and_dirty-supervised-fine-tuning
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/swamikannan/quick_and_dirty-supervised-fine-tuning
- Owner: SwamiKannan
- License: mit
- Created: 2024-01-02T12:54:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-14T16:30:41.000Z (over 1 year ago)
- Last Synced: 2025-01-14T02:47:19.025Z (9 months ago)
- Language: Jupyter Notebook
- Size: 4.86 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Quick and Dirty series: Fine tuning a Huggingface model with a Huggingface Dataset
This is basically a quick get to go fine-tuning exercise, inspired by the hundreds of notebooks that have been done for Diffusion models.
# Requirements:
1. A Google account (with Drive and Colab available)
2. A [Huggingface account](https://huggingface.co/join)## Usage:
1. Upload this notebook to Google Colab.
2. Copy your Huggingface key. A Huggingface key can be obtained as follows:
- Login to Huggingface
- In the top right corner, click on the profile link and go to Settings
- In the Settings page, click on Access Tokens and then copy the link of the key in the access page
![]()
Store this temporarily on a note page for step 5 below:
3. Run cell 1 to install the libraries
4. Run cell 2 to allow the notebook to access your Google Drive. This is **specifically** to allow the notebook to store all the generated products to your Google drive. Google colab deletes all the data it generates (models, logs, etc.) from its memory when the runtime is disconnected
5. Run cell 3 to authenticate your Huggingface account. This is **specifically** to allow the notebook to push your final finetuned model directly to your Huggingface account.
6. Fill in the details in the section 3. USER INPUTS". Mandatory details include:
- Dataset name
- Split
7. Update the code for the function update_dataset(). If no data processing is required, just point the appropriate column names to df['question'] and df['answer'].
*Example: if the column "professor" in the dataframe has the input for the question, and the column "student" in the data frames has the input of the answer, update the function as follows:*
```
df['question] = df['professor']
df['answer']=df['student']
```
8. Run the rest of the code cells one after the other
### Notes:
- Make sure you do not store your Hugginface key where others can access it. Else, people can easily access any service (free or paid) if they have access to your key.
- Make sure the section 3. USER INPUTS without any errors/ messages. Else, this will prevent the rest of the code from running acccurately.
- The default model used is mistralai/Mistral-7B-v0.1 . Hence, if no model_name is given, this is the model that will be used.
#### Credits:
Speedometer image from PNGEGG
Tuning photo from Gangmin Li's Do A Data Science Project in 10 Days