Join the conversation

Join the community of Machine Learners and AI enthusiasts.

Sign Up
s3nh 
posted an update Jan 22
Post
GPU Poor POV: Dont be Afraid :D

Sometimes we dont want to do something because of low self esteem,
I ofter hear 'its to hard for me','i am not an expert','i do not know how to do it', etc. These words are never the truth, we should not be afraid and try to build something because there is no additive value without a failure.

Same things comes in LLMs, there is a lot of fancy words happening, but whats is more important is that there are also people who are constantly building so other can build. Diving into finetuning LLMs is incredibly simple if we assume using axolotl library and pretrains stored on huggingface.

All we need is an idea, our GPU Poor desktop or colab notebooks and these steps:
git clone https://github.com/OpenAccess-AI-Collective/axolotl
cd axolotl

pip3 install packaging
pip3 install -e '.[flash-attn,deepspeed]'

After installation process we can go to examples, and modify configs to our own needs.
Lets jump into
axolotl\examples\llama-2\qlora.yml

and change
base_model: NousResearch/Llama-2-7b-hf

to
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0

choose dataset from huge amounts of dataset that are possible to use from hf.co/datasets and tweak additional params like batch_size, number of epochs, how often do we want to save our model and many more (which I wont focus on rn).
Then,
accelerate launch -m axolotl.cli.train examples/llama-2/qlora.yml

Will allow to start the finetuning process on structure defined strictly by you. After finetuning, model will be saved in path provided in config, and you can check out if it performs better than the base one. Or even you can put it on llm Leaderboard to check if we do not have new SOTA :)
Have fun and have a great day <3

This is a great post! axolotl is alot of fun

For the GPU destitute and patient, llama.cpp supports CPU based LORA finetuning:

https://github.com/ggerganov/llama.cpp/blob/master/examples/finetune/README.md
https://rentry.org/cpu-lora

I'm experiencing this error when doing the second pip3 command:
ERROR: '.[flash-attn,deepspeed]' is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).

Any insights?

·

Could you please try to change this line to

pip install e  .

We do not need deep speed and flash attention for this exact run. Also, I forgot to mention that it is tested to run on Linux environment. Maybe I should prepare colab notebook, itll be much nicer for eventual error tracking.
Let me know if it works, you can also DM me on x.com/s3nhs3nh , Ill be glad to help ^^