arnocandel commited on
Commit
95f74df
·
1 Parent(s): 252f114

commit files to HF hub

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