yys commited on
Commit
29f5049
1 Parent(s): ee87a67

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,3 +1,68 @@
1
  ---
 
2
  license: apache-2.0
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ library_name: transformers
3
  license: apache-2.0
4
+ basemodel: google/gemma-7b
5
  ---
6
+
7
+ ## Model Card for Firefly-Gemma
8
+
9
+ [gemma-7B-it-firefly](https://huggingface.co/yys/gemma-7B-it-firefly) is trained based on [gemma-7b-it](https://huggingface.co/google/gemma-7b-it) to act as a helpful and harmless AI assistant.
10
+ We use [Firefly](https://github.com/yangjianxin1/Firefly) to train the model with LoRA.
11
+
12
+ <img src="open_llm_leaderboard.png" width="800">
13
+
14
+ We advise you to install transformers>=4.38.2.
15
+
16
+ ## Performance
17
+ We evaluate our models on [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard), they achieve good performance.
18
+
19
+
20
+ ## Usage
21
+ The chat template of our chat models is similar as Official gemma-7b-it:
22
+ ```text
23
+ <bos><start_of_turn>user
24
+ hello, who are you?<end_of_turn>
25
+ <start_of_turn>model
26
+ I am a AI program developed by Firefly<eos>
27
+ ```
28
+
29
+ You can use script to inference in [Firefly](https://github.com/yangjianxin1/Firefly/blob/master/script/chat/chat.py).
30
+
31
+ You can also use the following code:
32
+ ```python
33
+ from transformers import AutoModelForCausalLM, AutoTokenizer
34
+ import torch
35
+
36
+ model_name_or_path = "yys/gemma-7B-it-firefly"
37
+ model = AutoModelForCausalLM.from_pretrained(
38
+ model_name_or_path,
39
+ trust_remote_code=True,
40
+ low_cpu_mem_usage=True,
41
+ torch_dtype=torch.float16,
42
+ device_map='auto',
43
+ )
44
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
45
+
46
+ prompt = "Compose an engaging travel blog post about a recent trip to Hawaii, highlighting cultural experiences and must-see attractions. "
47
+ text = f"""
48
+ <bos><start_of_turn>user
49
+ {prompt}<end_of_turn>
50
+ <start_of_turn>model
51
+ """.strip()
52
+ model_inputs = tokenizer([text], return_tensors="pt").to('cuda')
53
+
54
+ generated_ids = model.generate(
55
+ model_inputs.input_ids,
56
+ max_new_tokens=1500,
57
+ top_p = 0.9,
58
+ temperature = 0.35,
59
+ repetition_penalty = 1.0,
60
+ eos_token_id=tokenizer.encode('<eos>', add_special_tokens=False)
61
+ )
62
+ generated_ids = [
63
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
64
+ ]
65
+
66
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
67
+ print(response)
68
+ ```
configuration.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"framework":"Pytorch","task":"text-generation"}
model-00001-of-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d5fce47ce004f8254e44a9302903aea938dc682aa9092a38d4bc971f2cd224c2
3
+ size 1975518024
model-00002-of-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d3bbb82c30efd5346cfbd5e633faf9f2d97a10cb87ad35cb97a8a8c9859bd8e
3
+ size 1912655712
model-00003-of-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe4503921553fc4e1f346d0ca38003e982b18020d295b13332423bf56ef1bed2
3
+ size 1962974488
model-00004-of-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:449abe972ce0775c7cc42767ce4bc47f29249874ee2c3540cde486d1f4be7e4a
3
+ size 1912655720
model-00005-of-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:99dc77674a2a7c093ac1b92aa141ee9f7ea66ac7c537a2da12d732896ff482a1
3
+ size 1962974520
model-00006-of-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e9e46f54b9b0d637ec6aa511a025d2b7efb9c458308a1369b2477a8ca1268063
3
+ size 1912655744
model-00007-of-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2b044cc870eefa65177bec6e16295cc2a473f14278e167fa682063a7e1b39e4
3
+ size 1962974520
model-00008-of-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:604e2de041633dca3a0f2249a91267188fc80692ea1c9a8895e63edbab6ff0e1
3
+ size 1912655744
model-00009-of-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3ce8031e2f1755f123e568898d8ab5153a6de2a507f27bc81377d3aadfc2bb0
3
+ size 1560326864