Lewdiculous commited on
Commit
c4411dc
1 Parent(s): 7fbda33

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +99 -0
README.md CHANGED
@@ -1,3 +1,102 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ tags:
4
+ - gemma
5
+ - gguf
6
+ - quantized
7
+ inference: false
8
  ---
9
+
10
+ GGUF-IQ-Imatrix quants for [YeungNLP/firefly-gemma-7b](https://huggingface.co/YeungNLP/firefly-gemma-7b):
11
+
12
+ ```python
13
+ quantization_options = [
14
+ "IQ2_XXS", "IQ2_XS", "IQ2_S", "IQ2_M", "Q3_K_M",
15
+ "Q4_K_M", "Q4_K_S", "IQ4_XS", "Q5_K_M", "Q5_K_S",
16
+ "Q6_K", "Q8_0", "IQ3_M", "IQ3_S", "IQ3_XXS"
17
+ ]
18
+ ```
19
+
20
+ [Requested by Cran-May.](https://huggingface.co/Lewdiculous/Model-Requests/discussions/8)
21
+
22
+ **Model card image:**
23
+
24
+ ![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/65d4cf2693a0a3744a27536c/SrOekTxdpnxHyWWmMiAvc.jpeg)
25
+
26
+ ## Model Card for Firefly-Gemma:
27
+
28
+ [firefly-gemma-7b](https://huggingface.co/YeungNLP/firefly-gemma-7b) is trained based on [gemma-7b](https://huggingface.co/google/gemma-7b) to act as a helpful and harmless AI assistant.
29
+ We use [Firefly](https://github.com/yangjianxin1/Firefly) to train the model on **a single V100 GPU** with QLoRA.
30
+
31
+ Our model outperforms the official [gemma-7b-it](https://huggingface.co/google/gemma-7b-it), [zephyr-7b-gemma-v0.1](https://huggingface.co/HuggingFaceH4/zephyr-7b-gemma-v0.1), [Qwen1.5-7B-Chat](https://huggingface.co/Qwen/Qwen1.5-7B-Chat) and [Zephyr-7B-Beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) on [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
32
+
33
+ <img src="open_llm_leaderboard.png" width="800">
34
+
35
+ We advise you to install transformers>=4.38.1.
36
+
37
+ ## Performance
38
+ We evaluate our models on [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard), they achieve good performance.
39
+
40
+ | Model | Average | ARC | HellaSwag | MMLU | TruthfulQA | Winogrande | GSM8K |
41
+ |--------------------------------|--------|--------|-----------|--------|------------|-----------|--------|
42
+ | **firefly-gemma-7b** | 62.93 | 62.12 | 79.77 | 61.57 | 49.41 | 75.45 | 49.28 |
43
+ | zephyr-7b-gemma-v0.1 |62.41|58.45|83.48|60.68|52.07| 74.19| 45.56|
44
+ | firefly-qwen1.5-en-7b-dpo-v0.1 | 62.36 | 54.35 | 76.04 | 61.21 | 56.4 | 72.06 | 54.13 |
45
+ | zephyr-7b-beta | 61.95 | 62.03 | 84.36 | 61.07 | 57.45 | 77.74 | 29.04 |
46
+ | firefly-qwen1.5-en-7b | 61.44 | 53.41 | 75.51 | 61.67 |51.96 |70.72 | 55.34 |
47
+ | vicuna-13b-v1.5 | 55.41 | 57.08 | 81.24 | 56.67 | 51.51 | 74.66 | 11.3 |
48
+ | Xwin-LM-13B-V0.1 | 55.29 | 62.54 | 82.8 | 56.53 | 45.96 | 74.27 | 9.63 |
49
+ | Qwen1.5-7B-Chat | 55.15 | 55.89 | 78.56 | 61.65 | 53.54 | 67.72 | 13.57 |
50
+ | gemma-7b-it | 53.56 | 51.45 | 71.96 | 53.52 | 47.29 | 67.96 | 29.19 |
51
+
52
+
53
+
54
+ ## Usage
55
+ The chat template of our chat models is similar as Official gemma-7b-it:
56
+ ```text
57
+ <bos><start_of_turn>user
58
+ hello, who are you?<end_of_turn>
59
+ <start_of_turn>model
60
+ I am a AI program developed by Firefly<eos>
61
+ ```
62
+
63
+ You can use script to inference in [Firefly](https://github.com/yangjianxin1/Firefly/blob/master/script/chat/chat.py).
64
+
65
+ You can also use the following code:
66
+ ```python
67
+ from transformers import AutoModelForCausalLM, AutoTokenizer
68
+ import torch
69
+
70
+ model_name_or_path = "YeungNLP/firefly-gemma-7b"
71
+ model = AutoModelForCausalLM.from_pretrained(
72
+ model_name_or_path,
73
+ trust_remote_code=True,
74
+ low_cpu_mem_usage=True,
75
+ torch_dtype=torch.float16,
76
+ device_map='auto',
77
+ )
78
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
79
+
80
+ prompt = "Compose an engaging travel blog post about a recent trip to Hawaii, highlighting cultural experiences and must-see attractions. "
81
+ text = f"""
82
+ <bos><start_of_turn>user
83
+ {prompt}<end_of_turn>
84
+ <start_of_turn>model
85
+ """.strip()
86
+ model_inputs = tokenizer([text], return_tensors="pt").to('cuda')
87
+
88
+ generated_ids = model.generate(
89
+ model_inputs.input_ids,
90
+ max_new_tokens=1500,
91
+ top_p = 0.9,
92
+ temperature = 0.35,
93
+ repetition_penalty = 1.0,
94
+ eos_token_id=tokenizer.encode('<eos>', add_special_tokens=False)
95
+ )
96
+ generated_ids = [
97
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
98
+ ]
99
+
100
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
101
+ print(response)
102
+ ```