Views
No views yet
h2ogpt-oasst1-falcon-40b is a 40 billion parameter instruction-following large language model licensed for commercial use.
transformers library on a machine with GPUs, first make sure you have the following libraries installed.1pip install transformers==4.29.2
2pip install accelerate==0.19.0
3pip install torch==2.0.1
4pip install einops==0.6.11import torch
2from transformers import pipeline, AutoTokenizer
3
4tokenizer = AutoTokenizer.from_pretrained("h2oai/h2ogpt-oasst1-falcon-40b", padding_side="left")
5generate_text = pipeline(model="h2oai/h2ogpt-oasst1-falcon-40b", tokenizer=tokenizer, torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto", prompt_type="human_bot")
6res = generate_text("Why is drinking water so healthy?", max_new_tokens=100)
7print(res[0]["generated_text"])trust_remote_code=True you can download instruct_pipeline.py,
store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer:1import torch
2from h2oai_pipeline import H2OTextGenerationPipeline
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5tokenizer = AutoTokenizer.from_pretrained("h2oai/h2ogpt-oasst1-falcon-40b", padding_side="left")
6model = AutoModelForCausalLM.from_pretrained("h2oai/h2ogpt-oasst1-falcon-40b", torch_dtype=torch.bfloat16, device_map="auto")
7generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer, prompt_type="human_bot")
8
9res = generate_text("Why is drinking water so healthy?", max_new_tokens=100)
10print(res[0]["generated_text"])RWForCausalLM(
(transformer): RWModel(
(word_embeddings): Embedding(65024, 8192)
(h): ModuleList(
(0-59): 60 x DecoderLayer(
(ln_attn): LayerNorm((8192,), eps=1e-05, elementwise_affine=True)
(ln_mlp): LayerNorm((8192,), eps=1e-05, elementwise_affine=True)
(self_attention): Attention(
(maybe_rotary): RotaryEmbedding()
(query_key_value): Linear(in_features=8192, out_features=9216, bias=False)
(dense): Linear(in_features=8192, out_features=8192, bias=False)
(attention_dropout): Dropout(p=0.0, inplace=False)
)
(mlp): MLP(
(dense_h_to_4h): Linear(in_features=8192, out_features=32768, bias=False)
(act): GELU(approximate='none')
(dense_4h_to_h): Linear(in_features=32768, out_features=8192, bias=False)
)
)
)
(ln_f): LayerNorm((8192,), eps=1e-05, elementwise_affine=True)
)
(lm_head): Linear(in_features=8192, out_features=65024, bias=False)
)1RWConfig {
2 "_name_or_path": "h2oai/h2ogpt-oasst1-falcon-40b",
3 "alibi": false,
4 "apply_residual_connection_post_layernorm": false,
5 "architectures": [
6 "RWForCausalLM"
7 ],
8 "attention_dropout": 0.0,
9 "auto_map": {
10 "AutoConfig": "tiiuae/falcon-40b--configuration_RW.RWConfig",
11 "AutoModel": "tiiuae/falcon-40b--modelling_RW.RWModel",
12 "AutoModelForCausalLM": "tiiuae/falcon-40b--modelling_RW.RWForCausalLM",
13 "AutoModelForQuestionAnswering": "tiiuae/falcon-40b--modelling_RW.RWForQuestionAnswering",
14 "AutoModelForSequenceClassification": "tiiuae/falcon-40b--modelling_RW.RWForSequenceClassification",
15 "AutoModelForTokenClassification": "tiiuae/falcon-40b--modelling_RW.RWForTokenClassification"
16 },
17 "bias": false,
18 "bos_token_id": 11,
19 "custom_pipelines": {
20 "text-generation": {
21 "impl": "h2oai_pipeline.H2OTextGenerationPipeline",
22 "pt": "AutoModelForCausalLM"
23 }
24 },
25 "eos_token_id": 11,
26 "hidden_dropout": 0.0,
27 "hidden_size": 8192,
28 "initializer_range": 0.02,
29 "layer_norm_epsilon": 1e-05,
30 "model_type": "RefinedWeb",
31 "n_head": 128,
32 "n_head_kv": 8,
33 "n_layer": 60,
34 "parallel_attn": true,
35 "torch_dtype": "float16",
36 "transformers_version": "4.30.0.dev0",
37 "use_cache": true,
38 "vocab_size": 65024
39}
40| Task | Version | Metric | Value | Stderr | |
|---|---|---|---|---|---|
| arc_challenge | 0 | acc | 0.5196 | ± | 0.0146 |
| acc_norm | 0.5461 | ± | 0.0145 | ||
| arc_easy | 0 | acc | 0.8190 | ± | 0.0079 |
| acc_norm | 0.7799 | ± | 0.0085 | ||
| boolq | 1 | acc | 0.8514 | ± | 0.0062 |
| hellaswag | 0 | acc | 0.6485 | ± | 0.0048 |
| acc_norm | 0.8314 | ± | 0.0037 | ||
| openbookqa | 0 | acc | 0.3860 | ± | 0.0218 |
| acc_norm | 0.4880 | ± | 0.0224 | ||
| piqa | 0 | acc | 0.8194 | ± | 0.0090 |
| acc_norm | 0.8335 | ± | 0.0087 | ||
| winogrande | 0 | acc | 0.7751 | ± | 0.0117 |