ilu000 commited on
Commit
9803ff0
1 Parent(s): cea8438

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -19
README.md CHANGED
@@ -8,31 +8,46 @@ tags:
8
  - large language model
9
  - h2o-llmstudio
10
  inference: false
11
- thumbnail: https://h2o.ai/etc.clientlibs/h2o/clientlibs/clientlib-site/resources/images/favicon.ico
 
 
 
 
12
  ---
13
  # Model Card
14
  ## Summary
15
 
16
  This model was trained using [H2O LLM Studio](https://github.com/h2oai/h2o-llmstudio).
17
  - Base model: [tiiuae/falcon-7b](https://huggingface.co/tiiuae/falcon-7b)
 
18
 
19
 
20
  ## Usage
21
 
22
- To use the model with the `transformers` library on a machine with GPUs, first make sure you have the `transformers`, `accelerate` and `torch` libraries installed.
23
 
24
  ```bash
25
- pip install transformers==4.28.1
26
- pip install accelerate==0.18.0
27
  pip install torch==2.0.0
 
28
  ```
29
 
30
  ```python
31
  import torch
32
- from transformers import pipeline
 
 
 
 
 
 
 
 
33
 
34
  generate_text = pipeline(
35
  model="h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3",
 
36
  torch_dtype=torch.float16,
37
  trust_remote_code=True,
38
  use_fast=False,
@@ -62,7 +77,7 @@ print(generate_text.preprocess("Why is drinking water so healthy?")["prompt_text
62
  <|prompt|>Why is drinking water so healthy?<|endoftext|><|answer|>
63
  ```
64
 
65
- Alternatively, if you prefer to not use `trust_remote_code=True` you can download [h2oai_pipeline.py](h2oai_pipeline.py), store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer:
66
 
67
 
68
  ```python
@@ -73,12 +88,14 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
73
  tokenizer = AutoTokenizer.from_pretrained(
74
  "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3",
75
  use_fast=False,
76
- padding_side="left"
 
77
  )
78
  model = AutoModelForCausalLM.from_pretrained(
79
  "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3",
80
  torch_dtype=torch.float16,
81
- device_map={"": "cuda:0"}
 
82
  )
83
  generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer)
84
 
@@ -106,8 +123,17 @@ model_name = "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3" # either local folde
106
  # You can find an example prompt in the experiment logs.
107
  prompt = "<|prompt|>How are you?<|endoftext|><|answer|>"
108
 
109
- tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False)
110
- model = AutoModelForCausalLM.from_pretrained(model_name)
 
 
 
 
 
 
 
 
 
111
  model.cuda().eval()
112
  inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
113
 
@@ -161,15 +187,6 @@ RWForCausalLM(
161
  This model was trained using H2O LLM Studio and with the configuration in [cfg.yaml](cfg.yaml). Visit [H2O LLM Studio](https://github.com/h2oai/h2o-llmstudio) to learn how to train your own large language models.
162
 
163
 
164
- ## Model Validation
165
-
166
- Model validation results using [EleutherAI lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness).
167
-
168
- ```bash
169
- CUDA_VISIBLE_DEVICES=0 python main.py --model hf-causal-experimental --model_args pretrained=h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3 --tasks openbookqa,arc_easy,winogrande,hellaswag,arc_challenge,piqa,boolq --device cuda &> eval.log
170
- ```
171
-
172
-
173
  ## Disclaimer
174
 
175
  Please read this disclaimer carefully before using the large language model provided in this repository. Your use of the model signifies your agreement to the following terms and conditions.
 
8
  - large language model
9
  - h2o-llmstudio
10
  inference: false
11
+ thumbnail: >-
12
+ https://h2o.ai/etc.clientlibs/h2o/clientlibs/clientlib-site/resources/images/favicon.ico
13
+ license: apache-2.0
14
+ datasets:
15
+ - OpenAssistant/oasst1
16
  ---
17
  # Model Card
18
  ## Summary
19
 
20
  This model was trained using [H2O LLM Studio](https://github.com/h2oai/h2o-llmstudio).
21
  - Base model: [tiiuae/falcon-7b](https://huggingface.co/tiiuae/falcon-7b)
22
+ - Dataset preparation: [OpenAssistant/oasst1](https://github.com/h2oai/h2o-llmstudio/blob/1935d84d9caafed3ee686ad2733eb02d2abfce57/app_utils/utils.py#LL1896C5-L1896C28) personalized
23
 
24
 
25
  ## Usage
26
 
27
+ To use the model with the `transformers` library on a machine with GPUs, first make sure you have the `transformers`, `accelerate`, `torch` and `einops` libraries installed.
28
 
29
  ```bash
30
+ pip install transformers==4.29.2
31
+ pip install accelerate==0.19.0
32
  pip install torch==2.0.0
33
+ pip install einops==0.6.1
34
  ```
35
 
36
  ```python
37
  import torch
38
+ from transformers import AutoTokenizer, pipeline
39
+
40
+
41
+ tokenizer = AutoTokenizer.from_pretrained(
42
+ "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3",
43
+ use_fast=False,
44
+ padding_side="left",
45
+ trust_remote_code=True,
46
+ )
47
 
48
  generate_text = pipeline(
49
  model="h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3",
50
+ tokenizer=tokenizer,
51
  torch_dtype=torch.float16,
52
  trust_remote_code=True,
53
  use_fast=False,
 
77
  <|prompt|>Why is drinking water so healthy?<|endoftext|><|answer|>
78
  ```
79
 
80
+ Alternatively, you can download [h2oai_pipeline.py](h2oai_pipeline.py), store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer:
81
 
82
 
83
  ```python
 
88
  tokenizer = AutoTokenizer.from_pretrained(
89
  "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3",
90
  use_fast=False,
91
+ padding_side="left",
92
+ trust_remote_code=True,
93
  )
94
  model = AutoModelForCausalLM.from_pretrained(
95
  "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3",
96
  torch_dtype=torch.float16,
97
+ device_map={"": "cuda:0"},
98
+ trust_remote_code=True,
99
  )
100
  generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer)
101
 
 
123
  # You can find an example prompt in the experiment logs.
124
  prompt = "<|prompt|>How are you?<|endoftext|><|answer|>"
125
 
126
+ tokenizer = AutoTokenizer.from_pretrained(
127
+ model_name,
128
+ use_fast=False,
129
+ trust_remote_code=True,
130
+ )
131
+ model = AutoModelForCausalLM.from_pretrained(
132
+ model_name,
133
+ torch_dtype=torch.float16,
134
+ device_map={"": "cuda:0"},
135
+ trust_remote_code=True,
136
+ )
137
  model.cuda().eval()
138
  inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
139
 
 
187
  This model was trained using H2O LLM Studio and with the configuration in [cfg.yaml](cfg.yaml). Visit [H2O LLM Studio](https://github.com/h2oai/h2o-llmstudio) to learn how to train your own large language models.
188
 
189
 
 
 
 
 
 
 
 
 
 
190
  ## Disclaimer
191
 
192
  Please read this disclaimer carefully before using the large language model provided in this repository. Your use of the model signifies your agreement to the following terms and conditions.