ilu000 commited on
Commit
a8bb3b0
1 Parent(s): ddf17cf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -6
README.md CHANGED
@@ -24,7 +24,7 @@ This model was trained using [H2O LLM Studio](https://github.com/h2oai/h2o-llmst
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` and `torch` libraries installed.
28
 
29
  ```bash
30
  pip install transformers==4.29.2
@@ -68,7 +68,7 @@ print(generate_text.preprocess("Why is drinking water so healthy?")["prompt_text
68
  <|prompt|>Why is drinking water so healthy?<|endoftext|><|answer|>
69
  ```
70
 
71
- 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:
72
 
73
 
74
  ```python
@@ -79,12 +79,14 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
79
  tokenizer = AutoTokenizer.from_pretrained(
80
  "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b",
81
  use_fast=False,
82
- padding_side="left"
 
83
  )
84
  model = AutoModelForCausalLM.from_pretrained(
85
  "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b",
86
  torch_dtype=torch.float16,
87
- device_map={"": "cuda:0"}
 
88
  )
89
  generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer)
90
 
@@ -112,8 +114,17 @@ model_name = "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b" # either local folder o
112
  # You can find an example prompt in the experiment logs.
113
  prompt = "<|prompt|>How are you?<|endoftext|><|answer|>"
114
 
115
- tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False)
116
- model = AutoModelForCausalLM.from_pretrained(model_name)
 
 
 
 
 
 
 
 
 
117
  model.cuda().eval()
118
  inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
119
 
 
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
 
68
  <|prompt|>Why is drinking water so healthy?<|endoftext|><|answer|>
69
  ```
70
 
71
+ 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:
72
 
73
 
74
  ```python
 
79
  tokenizer = AutoTokenizer.from_pretrained(
80
  "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b",
81
  use_fast=False,
82
+ padding_side="left",
83
+ trust_remote_code=True,
84
  )
85
  model = AutoModelForCausalLM.from_pretrained(
86
  "h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b",
87
  torch_dtype=torch.float16,
88
+ device_map={"": "cuda:0"},
89
+ trust_remote_code=True,
90
  )
91
  generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer)
92
 
 
114
  # You can find an example prompt in the experiment logs.
115
  prompt = "<|prompt|>How are you?<|endoftext|><|answer|>"
116
 
117
+ tokenizer = AutoTokenizer.from_pretrained(
118
+ model_name,
119
+ use_fast=False,
120
+ trust_remote_code=True,
121
+ )
122
+ model = AutoModelForCausalLM.from_pretrained(
123
+ model_name,
124
+ torch_dtype=torch.float16,
125
+ device_map={"": "cuda:0"},
126
+ trust_remote_code=True,
127
+ )
128
  model.cuda().eval()
129
  inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
130