Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add A cli version #18

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
70 changes: 69 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# 🦙 Simple LLaMA Finetuner
# 🦙 Simple LLaMA Finetuner - CLI



[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/lxe/simple-llama-finetuner/blob/master/Simple_LLaMA_FineTuner.ipynb)
[![](https://img.shields.io/badge/no-bugs-brightgreen.svg)](https://github.com/lxe/no-bugs)
[![](https://img.shields.io/badge/coverage-%F0%9F%92%AF-green.svg)](https://github.com/lxe/onehundred/tree/master)



## Original README.md

Simple LLaMA Finetuner is a beginner-friendly interface designed to facilitate fine-tuning the [LLaMA-7B](https://github.com/facebookresearch/llama) language model using [LoRA](https://arxiv.org/abs/2106.09685) method via the [PEFT library](https://github.com/huggingface/peft) on commodity NVIDIA GPUs. With small dataset and sample lengths of 256, you can even run this on a regular Colab Tesla T4 instance.

With this intuitive UI, you can easily manage your dataset, customize parameters, train, and evaluate the model's inference capabilities.
Expand Down Expand Up @@ -71,11 +77,73 @@ After training is done, navigate to "Inference" tab, click "Reload Models", sele

Have fun!


## Screenshots

|![Image1](https://user-images.githubusercontent.com/1486609/226793136-84531388-4081-49bb-b982-3f47e6ec25cd.png) | ![Image2](https://user-images.githubusercontent.com/1486609/226809466-b1eb6f3f-4049-4a41-a2e3-52b06a6e1230.png) |
|:---:|:---:|

## Cli version

- This is a cli version of [simple-llama-finetuner](https://github.com/lxe/simple-llama-finetuner/).
- This cli version is provided by [@chaignc](https://twitter.com/chaignc) from [Hacker AI Team](https://hacker-ai.ai).
- Thank you to the original author [@lxe](https://twitter.com/lxe), who did the real work :D

### Usage:

```
$ ./main_cli.py -h
Usage: main_cli.py command [args...]

Commands:
predict
train

$ ./main_cli.py train -h
Usage: main-cli.py train [OPTIONS]

Options:
--epochs=INT (default: 1)
--gradient-accumulation-steps=INT (default: 1)
--learning-rate=FLOAT (default: 0.0003)
--lora-alpha=INT (default: 16)
--lora-dropout=FLOAT (default: 0.01)
--lora-r=INT (default: 8)
--max-seq-length=INT (default: 512)
--micro-batch-size=INT (default: 1)
--model-name=STR (default: elderberry-cherry)
--training-file=STR (default: ./example-datasets/leo.txt)

Other actions:
-h, --help Show the help

$ ./main_cli.py predict -h
Usage: ./main_cli.py predict [OPTIONS]

Options:
--inference-text=STR (default: What is leo?)
--max-new-tokens=INT (default: 50)
--model-name=STR (default: ./lora-elderberry-cherry)
--repeat-penalty=INT (default: 1)
--temperature=FLOAT (default: 0.01)
--top-k=INT (default: 50)
--top-p=FLOAT (default: 0.3)

Other actions:
-h, --help Show the help


```

### How to use?

```
$ ./main_cli.py train --training-file ./example-datasets/leo.txt

$ ./main_cli.py predict --inference_text "C'est qui Paulivan"
Un gros faignant
```

## License

MIT License
Expand Down
8 changes: 8 additions & 0 deletions example-datasets/leo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Human: C'est qui Paulivan?

Assistant: un gros faignant


Human: C'est qui Sanson?

Assistant: C'est le plus gros faignant