Eteims commited on
Commit
71317bd
1 Parent(s): c6059cd

Made the README more descriptive.

Browse files
Files changed (1) hide show
  1. README.md +57 -20
README.md CHANGED
@@ -2,7 +2,6 @@
2
  license: gemma
3
  library_name: transformers
4
  tags:
5
- - trl
6
  - sft
7
  - generated_from_trainer
8
  base_model: google/gemma-7b
@@ -15,38 +14,80 @@ datasets:
15
  language:
16
  - en
17
  widget:
18
- - text: "Quote: With great power comes"
19
- example_title: "Example 1"
20
- - text: "Quote: Hasta la vista baby"
21
- example_title: "Example 2"
22
- - text: "Quote: Elementary, my dear watson."
23
- example_title: "Example 3"
24
  ---
25
 
26
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
27
  should probably proofread and complete it, then remove this comment. -->
28
 
29
- # outputs
 
 
 
 
30
 
31
- This model is a fine-tuned version of [google/gemma-7b](https://huggingface.co/google/gemma-7b) on an unknown dataset.
32
 
33
  ## Model description
34
 
35
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
- ## Intended uses & limitations
 
38
 
39
- More information needed
 
 
40
 
41
- ## Training and evaluation data
 
 
 
 
 
42
 
43
- More information needed
 
 
44
 
45
- ## Training procedure
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  ### Training hyperparameters
48
 
49
- The following hyperparameters were used during training:
50
  - learning_rate: 0.0002
51
  - train_batch_size: 1
52
  - eval_batch_size: 8
@@ -59,10 +100,6 @@ The following hyperparameters were used during training:
59
  - training_steps: 10
60
  - mixed_precision_training: Native AMP
61
 
62
- ### Training results
63
-
64
-
65
-
66
  ### Framework versions
67
 
68
  - PEFT 0.8.2
 
2
  license: gemma
3
  library_name: transformers
4
  tags:
 
5
  - sft
6
  - generated_from_trainer
7
  base_model: google/gemma-7b
 
14
  language:
15
  - en
16
  widget:
17
+ - text: 'Quote: With great power comes'
18
+ example_title: Example 1
19
+ - text: 'Quote: Hasta la vista baby'
20
+ example_title: Example 2
21
+ - text: 'Quote: Elementary, my dear watson.'
22
+ example_title: Example 3
23
  ---
24
 
25
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
26
  should probably proofread and complete it, then remove this comment. -->
27
 
28
+ # Gemma_ft_Quote
29
+
30
+ This model is a fine-tuned version of [google/gemma-7b](https://huggingface.co/google/gemma-7b) on the [english quote](https://huggingface.co/datasets/Abirate/english_quotes) dataset using [LoRA](https://arxiv.org/abs/2106.09685).
31
+ It is based on the example provided by google [here](https://huggingface.co/google/gemma-7b/blob/main/examples/notebook_sft_peft.ipynb).
32
+ The notebook used to fine-tune the model can be found [here](https://colab.research.google.com/drive/1OMvXuK77X7yxofrhQHERUkrn3NZORXFp?usp=sharing)
33
 
 
34
 
35
  ## Model description
36
 
37
+ The model can complete popular quotes given to it and add the author of the quote. For example, Given the qoute below:
38
+
39
+ ```
40
+ Quote: With great power comes
41
+ ```
42
+
43
+ The model would complete the quote and add the author of the quote:
44
+
45
+ ```
46
+ Quote: With great power comes great responsibility. Author: Ben Parker.
47
+ ```
48
+
49
+ Given a complete Quoute the model would add the author:
50
+
51
+ ```
52
+ Quote: I'll be back. Author: Arnold Schwarzenegger.
53
+ ```
54
+
55
+ ## Usage
56
 
57
+ The model can be used with [transformers](https://huggingface.co/docs/transformers/en/index) library. Here's an example of loading the model
58
+ in 4 bit quantization mode:
59
 
60
+ ```python
61
+ import torch
62
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
63
 
64
+ model_id = "Eteims/gemma_ft_quote"
65
+ bnb_config = BitsAndBytesConfig(
66
+ load_in_4bit=True,
67
+ bnb_4bit_quant_type="nf4",
68
+ bnb_4bit_compute_dtype=torch.bfloat16
69
+ )
70
 
71
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
72
+ model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config, device_map="cuda:0")
73
+ ```
74
 
75
+ This code would easily run in a free colab tier.
76
+
77
+ After loading the model you can use it for inference:
78
+
79
+ ```python
80
+ text = "Quote: Elementary, my dear watson."
81
+ device = "cuda:0"
82
+ inputs = tokenizer(text, return_tensors="pt").to(device)
83
+
84
+ outputs = model.generate(**inputs, max_new_tokens=20)
85
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
86
+ ```
87
 
88
  ### Training hyperparameters
89
 
90
+ The following hyperparameters were used during fine-tuning:
91
  - learning_rate: 0.0002
92
  - train_batch_size: 1
93
  - eval_batch_size: 8
 
100
  - training_steps: 10
101
  - mixed_precision_training: Native AMP
102
 
 
 
 
 
103
  ### Framework versions
104
 
105
  - PEFT 0.8.2