AilexGPT commited on
Commit
61f6159
·
1 Parent(s): 371b2f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -38
app.py CHANGED
@@ -1,42 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- """Kopie von Llama 2 Fine-Tuning using QLora
3
 
4
- Automatically generated by Colaboratory.
5
-
6
- Original file is located at
7
- https://colab.research.google.com/drive/13dJqh-1y3KYGi5R82eqXGafkM5Y5k_ff
8
-
9
- **Code Credit: Hugging Face**
10
-
11
- **Dataset Credit: https://twitter.com/Dorialexander/status/1681671177696161794 **
12
-
13
- ## Finetune Llama-2-7b on a Google colab
14
-
15
- Welcome to this Google Colab notebook that shows how to fine-tune the recent Llama-2-7b model on a single Google colab and turn it into a chatbot
16
-
17
- We will leverage PEFT library from Hugging Face ecosystem, as well as QLoRA for more memory efficient finetuning
18
-
19
- ## Setup
20
-
21
- Run the cells below to setup and install the required libraries. For our experiment we will need `accelerate`, `peft`, `transformers`, `datasets` and TRL to leverage the recent [`SFTTrainer`](https://huggingface.co/docs/trl/main/en/sft_trainer). We will use `bitsandbytes` to [quantize the base model into 4bit](https://huggingface.co/blog/4bit-transformers-bitsandbytes). We will also install `einops` as it is a requirement to load Falcon models.
22
- """
23
-
24
- !pip install -q -U trl transformers accelerate git+https://github.com/huggingface/peft.git
25
- !pip install -q datasets bitsandbytes einops wandb
26
-
27
- """## Dataset
28
-
29
-
30
- """
31
-
32
- from datasets import load_dataset
33
-
34
- #dataset_name = "timdettmers/openassistant-guanaco" ###Human ,.,,,,,, ###Assistant
35
-
36
- dataset_name = 'AlexanderDoria/novel17_test' #french novels
37
- dataset = load_dataset(dataset_name, split="train")
38
-
39
- """## Loading the model"""
40
 
41
  import torch
42
  from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, AutoTokenizer
 
 
 
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  import torch
4
  from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, AutoTokenizer