arnocandel
commited on
Commit
•
e23d484
1
Parent(s):
d01fb16
commit files to HF hub
Browse files
README.md
CHANGED
@@ -1,3 +1,124 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
library_name: transformers
|
6 |
+
inference: false
|
7 |
+
thumbnail: https://h2o.ai/etc.clientlibs/h2o/clientlibs/clientlib-site/resources/images/favicon.ico
|
8 |
+
tags:
|
9 |
+
- gpt
|
10 |
+
- llm
|
11 |
+
- large language model
|
12 |
+
- open-source
|
13 |
+
datasets:
|
14 |
+
- h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v1
|
15 |
---
|
16 |
+
# h2oGPT Model Card
|
17 |
+
## Summary
|
18 |
+
|
19 |
+
H2O.ai's `h2ogpt-oig-oasst1-512-6.9b` is a 6.9 billion parameter instruction-following large language model licensed for commercial use.
|
20 |
+
|
21 |
+
- Base model: [EleutherAI/pythia-6.9b](https://huggingface.co/EleutherAI/pythia-6.9b)
|
22 |
+
- Fine-tuning dataset: [h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v1](https://huggingface.co/datasets/h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v1)
|
23 |
+
- Data-prep and fine-tuning code: [H2O.ai Github](https://github.com/h2oai/h2ogpt)
|
24 |
+
- Training logs: [zip](https://huggingface.co/h2oai/h2ogpt-oig-oasst1-512-6.9b/blob/main/pythia-6.9b.h2ogpt-oig-oasst1-instruct-cleaned-v1.json.1_epochs.5fc91911bc2bfaaf3b6c2de577c4b0ae45a07a4a.7.zip)
|
25 |
+
|
26 |
+
## Usage
|
27 |
+
|
28 |
+
To use the model with the `transformers` library on a machine with GPUs, first make sure you have the `transformers` and `accelerate` libraries installed.
|
29 |
+
|
30 |
+
```bash
|
31 |
+
pip install transformers==4.28.1
|
32 |
+
pip install accelerate==0.18.0
|
33 |
+
```
|
34 |
+
|
35 |
+
```python
|
36 |
+
import torch
|
37 |
+
from transformers import pipeline
|
38 |
+
|
39 |
+
generate_text = pipeline(model="h2oai/h2ogpt-oig-oasst1-512-6.9b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
|
40 |
+
|
41 |
+
res = generate_text("Why is drinking water so healthy?", max_new_tokens=100)
|
42 |
+
print(res[0]["generated_text"])
|
43 |
+
```
|
44 |
+
|
45 |
+
Alternatively, if you prefer to not use `trust_remote_code=True` you can download [instruct_pipeline.py](https://huggingface.co/h2oai/h2ogpt-oig-oasst1-512-6.9b/blob/main/h2oai_pipeline.py),
|
46 |
+
store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer:
|
47 |
+
|
48 |
+
```python
|
49 |
+
import torch
|
50 |
+
from h2oai_pipeline import H2OTextGenerationPipeline
|
51 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
52 |
+
|
53 |
+
tokenizer = AutoTokenizer.from_pretrained("h2oai/h2ogpt-oig-oasst1-512-6.9b", padding_side="left")
|
54 |
+
model = AutoModelForCausalLM.from_pretrained("h2oai/h2ogpt-oig-oasst1-512-6.9b", torch_dtype=torch.bfloat16, device_map="auto")
|
55 |
+
generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer)
|
56 |
+
|
57 |
+
res = generate_text("Why is drinking water so healthy?", max_new_tokens=100)
|
58 |
+
print(res[0]["generated_text"])
|
59 |
+
```
|
60 |
+
|
61 |
+
## Model Architecture
|
62 |
+
|
63 |
+
```
|
64 |
+
GPTNeoXForCausalLM(
|
65 |
+
(gpt_neox): GPTNeoXModel(
|
66 |
+
(embed_in): Embedding(50432, 4096)
|
67 |
+
(layers): ModuleList(
|
68 |
+
(0-31): 32 x GPTNeoXLayer(
|
69 |
+
(input_layernorm): LayerNorm((4096,), eps=1e-05, elementwise_affine=True)
|
70 |
+
(post_attention_layernorm): LayerNorm((4096,), eps=1e-05, elementwise_affine=True)
|
71 |
+
(attention): GPTNeoXAttention(
|
72 |
+
(rotary_emb): RotaryEmbedding()
|
73 |
+
(query_key_value): Linear(in_features=4096, out_features=12288, bias=True)
|
74 |
+
(dense): Linear(in_features=4096, out_features=4096, bias=True)
|
75 |
+
)
|
76 |
+
(mlp): GPTNeoXMLP(
|
77 |
+
(dense_h_to_4h): Linear(in_features=4096, out_features=16384, bias=True)
|
78 |
+
(dense_4h_to_h): Linear(in_features=16384, out_features=4096, bias=True)
|
79 |
+
(act): GELUActivation()
|
80 |
+
)
|
81 |
+
)
|
82 |
+
)
|
83 |
+
(final_layer_norm): LayerNorm((4096,), eps=1e-05, elementwise_affine=True)
|
84 |
+
)
|
85 |
+
(embed_out): Linear(in_features=4096, out_features=50432, bias=False)
|
86 |
+
)
|
87 |
+
```
|
88 |
+
|
89 |
+
## Model Configuration
|
90 |
+
|
91 |
+
```json
|
92 |
+
GPTNeoXConfig {
|
93 |
+
"_name_or_path": "h2oai/h2ogpt-oig-oasst1-512-6.9b",
|
94 |
+
"architectures": [
|
95 |
+
"GPTNeoXForCausalLM"
|
96 |
+
],
|
97 |
+
"bos_token_id": 0,
|
98 |
+
"custom_pipeline": {
|
99 |
+
"text-generation": {
|
100 |
+
"impl": "h2oai_pipeline.H2OTextGenerationPipeline",
|
101 |
+
"pt": "AutoModelForCausalLM"
|
102 |
+
}
|
103 |
+
},
|
104 |
+
"eos_token_id": 0,
|
105 |
+
"hidden_act": "gelu",
|
106 |
+
"hidden_size": 4096,
|
107 |
+
"initializer_range": 0.02,
|
108 |
+
"intermediate_size": 16384,
|
109 |
+
"layer_norm_eps": 1e-05,
|
110 |
+
"max_position_embeddings": 2048,
|
111 |
+
"model_type": "gpt_neox",
|
112 |
+
"num_attention_heads": 32,
|
113 |
+
"num_hidden_layers": 32,
|
114 |
+
"rotary_emb_base": 10000,
|
115 |
+
"rotary_pct": 0.25,
|
116 |
+
"tie_word_embeddings": false,
|
117 |
+
"torch_dtype": "float16",
|
118 |
+
"transformers_version": "4.28.1",
|
119 |
+
"use_cache": true,
|
120 |
+
"use_parallel_residual": true,
|
121 |
+
"vocab_size": 50432
|
122 |
+
}
|
123 |
+
|
124 |
+
```
|