# h2oGPT Model Card
## Summary

H2O.ai's `h2oai/h2ogpt-research-oig-oasst1-512-30b` is a 30 billion parameter instruction-following large language model for research use only.

We provide LORA weights based upon the base model listed below.

- Base model: [decapoda-research/llama-30b-hf](https://huggingface.co/decapoda-research/llama-30b-hf)
- Fine-tuning dataset: [h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v2](https://huggingface.co/datasets/h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v2)
- Data-prep and fine-tuning code: [H2O.ai GitHub](https://github.com/h2oai/h2ogpt)
- Training logs: [zip](https://huggingface.co/h2oai/h2ogpt-research-oig-oasst1-512-30b/blob/main/llama-30b-hf.h2oaih2ogpt-oig-oasst1-instruct-cleaned-v2.2.0_epochs.131f6d098b43236b5f91e76fc074ad089d6df368.llama30b_17.zip)

The model was trained using h2oGPT code as:

```python
torchrun --nproc_per_node=8 finetune.py --base_model=decapoda-research/llama-30b-hf --micro_batch_size=1 --batch_size=8 --cutoff_len=512 --num_epochs=2.0 --val_set_size=0 --eval_steps=100000 --save_steps=17000 --save_total_limit=20 --prompt_type=plain --save_code=True --train_8bit=False --run_id=llama30b_17 --llama_flash_attn=True --lora_r=64 --lora_target_modules=['q_proj', 'k_proj', 'v_proj', 'o_proj'] --learning_rate=2e-4 --lora_alpha=32 --drop_truncations=True --data_path=h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v2 --data_mix_in_path=h2oai/openassistant_oasst1_h2ogpt --data_mix_in_factor=1.0 --data_mix_in_prompt_type=plain --data_mix_in_col_dict={'input': 'input'}
```
On h2oGPT Hash: 131f6d098b43236b5f91e76fc074ad089d6df368

Only the last checkpoint at epoch 2.0 and step 137,846 is provided in this model repository because the LORA state is large enough and there are enough checkpoints to make total run 19GB.  Feel free to request additional checkpoints and we can consider adding more.

## Chatbot

- Run your own chatbot: [H2O.ai GitHub](https://github.com/h2oai/h2ogpt)
[![H2O.ai GitHub](https://user-images.githubusercontent.com/6147661/232930822-e7170e4d-8aa1-4f7a-ad70-ece9cdd8b0cb.png)](https://github.com/h2oai/h2ogpt)

## Usage:

This 30B model consumes about 66GB of GPU memory, so can operate on a single 80GB GPU or 2 48GB GPUs in 16-bit inference mode, or 1 48GB GPU in 8-bit inference mode.  But memory usage depends also on input length, etc.

### Usage as LORA:

Directly use the LORA as:

```bash
python generate.py --base_model=decapoda-research/llama-30b-hf --lora_weights=<lora_weights_path> --infer_devices=False 
```
This will start the chatbot with the LLaMa + LORA pre-loaded.  It can also be loaded directly from the gradio app after just doing:
```bash
python generate.py
```
by going to the models tab, adding the model name and LORA name to list, then loading that as the model/lora state.

Choose prompt_type of `human_bot` because that is the way it was instruct fine-tuned.

Here `<lora_weights_path>` is a directory of some name that contains the files in this HF model repository:

* adapter_config.json
* adapter_model.bin
* special_tokens_map.json
* tokenizer.model
* tokenizer_config.json

### Build HF model:

One can build an HF compatible model object from the base model and LORA.

Get: https://github.com/h2oai/h2ogpt/blob/main/export_hf_checkpoint.py and change:

```python
BASE_MODEL = 'decapoda-research/llama-30b-hf'
LORA_WEIGHTS = '<lora_weights_path>'
OUTPUT_NAME = "local_h2ogpt-research-oasst1-512-30b"
```
where `<lora_weights_path>` is same path that includes the files mentioned in last section.

To build the HF model, now just run

```bash
python export_hf_checkpoint.py
```

Once the HF model is built, to use the model with the `transformers` library on a machine with GPUs, first make sure you have the `transformers` and `accelerate` libraries installed.

```bash
pip install transformers==4.28.1
pip install accelerate==0.18.0
```

```python
import torch
from transformers import pipeline

generate_text = pipeline(model="local_h2ogpt-research-oasst1-512-30b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")

res = generate_text("Why is drinking water so healthy?", max_new_tokens=100)
print(res[0]["generated_text"])
```

Alternatively, if you prefer to not use `trust_remote_code=True` you can download [instruct_pipeline.py](h2oai_pipeline.py) and [stopping.py](stopping.py),
store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer:

```python
import torch
from h2oai_pipeline import H2OTextGenerationPipeline
from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("local_h2ogpt-research-oasst1-512-30b", padding_side="left")
model = AutoModelForCausalLM.from_pretrained("local_h2ogpt-research-oasst1-512-30b", torch_dtype=torch.bfloat16, device_map="auto")
generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer)

res = generate_text("Why is drinking water so healthy?", max_new_tokens=100)
print(res[0]["generated_text"])
```

## Model Architecture with LORA and flash attention

```
PeftModelForCausalLM(
  (base_model): LoraModel(
    (model): LlamaForCausalLM(
      (model): LlamaModel(
        (embed_tokens): Embedding(32000, 6656, padding_idx=31999)
        (layers): ModuleList(
          (0-59): 60 x LlamaDecoderLayer(
            (self_attn): LlamaAttention(
              (q_proj): Linear(
                in_features=6656, out_features=6656, bias=False
                (lora_dropout): ModuleDict(
                  (default): Dropout(p=0.05, inplace=False)
                )
                (lora_A): ModuleDict(
                  (default): Linear(in_features=6656, out_features=64, bias=False)
                )
                (lora_B): ModuleDict(
                  (default): Linear(in_features=64, out_features=6656, bias=False)
                )
              )
              (k_proj): Linear(
                in_features=6656, out_features=6656, bias=False
                (lora_dropout): ModuleDict(
                  (default): Dropout(p=0.05, inplace=False)
                )
                (lora_A): ModuleDict(
                  (default): Linear(in_features=6656, out_features=64, bias=False)
                )
                (lora_B): ModuleDict(
                  (default): Linear(in_features=64, out_features=6656, bias=False)
                )
              )
              (v_proj): Linear(
                in_features=6656, out_features=6656, bias=False
                (lora_dropout): ModuleDict(
                  (default): Dropout(p=0.05, inplace=False)
                )
                (lora_A): ModuleDict(
                  (default): Linear(in_features=6656, out_features=64, bias=False)
                )
                (lora_B): ModuleDict(
                  (default): Linear(in_features=64, out_features=6656, bias=False)
                )
              )
              (o_proj): Linear(
                in_features=6656, out_features=6656, bias=False
                (lora_dropout): ModuleDict(
                  (default): Dropout(p=0.05, inplace=False)
                )
                (lora_A): ModuleDict(
                  (default): Linear(in_features=6656, out_features=64, bias=False)
                )
                (lora_B): ModuleDict(
                  (default): Linear(in_features=64, out_features=6656, bias=False)
                )
              )
              (rotary_emb): LlamaRotaryEmbedding()
            )
            (mlp): LlamaMLP(
              (gate_proj): Linear(in_features=6656, out_features=17920, bias=False)
              (down_proj): Linear(in_features=17920, out_features=6656, bias=False)
              (up_proj): Linear(in_features=6656, out_features=17920, bias=False)
              (act_fn): SiLUActivation()
            )
            (input_layernorm): LlamaRMSNorm()
            (post_attention_layernorm): LlamaRMSNorm()
          )
        )
        (norm): LlamaRMSNorm()
      )
      (lm_head): Linear(in_features=6656, out_features=32000, bias=False)
    )
  )
)
trainable params: 204472320 || all params: 32733415936 || trainable%: 0.6246592790675496
```

## Model Configuration

```json
{
  "base_model_name_or_path": "decapoda-research/llama-30b-hf",
  "bias": "none",
  "fan_in_fan_out": false,
  "inference_mode": true,
  "init_lora_weights": true,
  "lora_alpha": 32,
  "lora_dropout": 0.05,
  "modules_to_save": null,
  "peft_type": "LORA",
  "r": 64,
  "target_modules": [
    "q_proj",
    "k_proj",
    "v_proj",
    "o_proj"
  ],
  "task_type": "CAUSAL_LM"
```

## Model Validation

Classical benchmarks align with base LLaMa 30B model, but are not useful for conversational purposes.  One could use GPT3.5 or GPT4 to evaluate responses, while here we use a [RLHF based reward model](https://huggingface.co/OpenAssistant/reward-model-deberta-v3-large-v2) developed by OpenAssistant to judge human preferences.  This is run using h2oGPT:

```python
python generate.py --base_model=decapoda-research/llama-30b-hf --gradio=False --infer_devices=False --eval_sharegpt_prompts_only=100 --eval_sharegpt_as_output=False --lora_weights=llama-30b-hf.h2oaih2ogpt-oig-oasst1-instruct-cleaned-v2.2.0_epochs.131f6d098b43236b5f91e76fc074ad089d6df368.llama30b_17
```
i.e. with 1 beam.  To reproduce, just replace the lora_weights path with your own path as described in previous sections.  Or for native HF models, just pass only base_model as HF model.


| Model       |RLHF Mean Score | RLHF Median Score | 
|-------------|----------------|-------------------|
|[h2oai/h2ogpt-research-oig-oasst1-512-30b](https://huggingface.co/h2oai/h2ogpt-research-oig-oasst1-512-30b)        | 0.55     | 0.58 |
|[OpenAssistant/oasst-sft-7-llama-30b-xor](https://huggingface.co/OpenAssistant/oasst-sft-7-llama-30b-xor)        | 0.51     | 0.48 |
|[h2oai/h2ogpt-oasst1-512-20b](https://huggingface.co/h2oai/h2ogpt-oasst1-512-20b)        | 0.49     | 0.48 |
|[h2oai/h2ogpt-gm-oasst1-en-1024-20b](https://huggingface.co/h2oai/h2ogpt-gm-oasst1-en-1024-20b) | 0.43 | 0.38 |
|[databricks/dolly-v2-12b](https://huggingface.co/databricks/dolly-v2-12b)        | 0.37     | 0.27 |

[Logs h2oai/h2ogpt-research-oig-oasst1-512-30b](https://huggingface.co/h2oai/h2ogpt-research-oig-oasst1-512-30b/blob/main/score_llama30b_jon17d.log) and [prompt-response pairs](https://huggingface.co/h2oai/h2ogpt-research-oig-oasst1-512-30b/blob/main/df_scores_100_100_1234_False_llama-30b-hf_llama-30b-hf.h2oaih2ogpt-oig-oasst1-instruct-cleaned-v2.2.0_epochs.131f6d098b43236b5f91e76fc074ad089d6df368.llama30b_17.parquet)

The full distribution of scores for h2ogpt-research-oig-oasst1-512-30b:

![image info](df_scores_100_100_1234_False_llama-30b-hf_llama-30b-hf.h2oaih2ogpt-oig-oasst1-instruct-cleaned-v2.2.0_epochs.131f6d098b43236b5f91e76fc074ad089d6df368.llama30b_17.png)

Same plot for h2oai/h2ogpt-oasst1-512-20b:

![image info](df_scores_100_100_1234_False_h2ogpt-oasst1-512-20b_.png)

[Logs h2oai/h2ogpt-oasst1-512-20b](score_h2ogpt-oasst1-512-20b_a.log)

Ran with 2 beams (1 beam leads to same mean but median of 0.44):
```python
python generate.py --base_model=h2oai/h2ogpt-oasst1-512-20b --gradio=False --infer_devices=False --eval_sharegpt_prompts_only=100 --eval_sharegpt_as_output=False --num_beams=2 &> score_h2ogpt-oasst1-512-20b_a.log
```

Same plot for h2oai/h2ogpt-gm-oasst1-en-1024-20b:

![image info](score_h2ogpt-gm-oasst1-en-1024-20b_a.png)

[Logs h2oai/h2ogpt-gm-oasst1-en-1024-20b](score_h2ogpt-gm-oasst1-en-1024-20b_a.log)

Ran with 2 beams:
```python
python generate.py --base_model=h2oai/h2ogpt-gm-oasst1-en-1024-20b --gradio=False --infer_devices=False --eval_sharegpt_prompts_only=100 --eval_sharegpt_as_output=False --num_beams=2 &> score_h2ogpt-gm-oasst1-en-1024-20b_a.log
```

Same plot for databricks/dolly-v2-12b:

![image info](df_scores_100_100_1234_False_dolly-v2-12b_.png)

[Logs databricks/dolly-v2-12b](score_dollyv2b.log)


## Disclaimer

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.

- The LORA contained in this repository is only for research (non-commercial) purposes.
- Biases and Offensiveness: The large language model is trained on a diverse range of internet text data, which may contain biased, racist, offensive, or otherwise inappropriate content. By using this model, you acknowledge and accept that the generated content may sometimes exhibit biases or produce content that is offensive or inappropriate. The developers of this repository do not endorse, support, or promote any such content or viewpoints.
- Limitations: The large language model is an AI-based tool and not a human. It may produce incorrect, nonsensical, or irrelevant responses. It is the user's responsibility to critically evaluate the generated content and use it at their discretion.
- Use at Your Own Risk: Users of this large language model must assume full responsibility for any consequences that may arise from their use of the tool. The developers and contributors of this repository shall not be held liable for any damages, losses, or harm resulting from the use or misuse of the provided model.
- Ethical Considerations: Users are encouraged to use the large language model responsibly and ethically. By using this model, you agree not to use it for purposes that promote hate speech, discrimination, harassment, or any form of illegal or harmful activities.
- Reporting Issues: If you encounter any biased, offensive, or otherwise inappropriate content generated by the large language model, please report it to the repository maintainers through the provided channels. Your feedback will help improve the model and mitigate potential issues.
- Changes to this Disclaimer: The developers of this repository reserve the right to modify or update this disclaimer at any time without prior notice. It is the user's responsibility to periodically review the disclaimer to stay informed about any changes.

By using the large language model provided in this repository, you agree to accept and comply with the terms and conditions outlined in this disclaimer. If you do not agree with any part of this disclaimer, you should refrain from using the model and any content generated by it.
{"language": ["en"], "license": "other", "library_name": "transformers", "tags": ["gpt", "llm", "large language model", "LLaMa"], "datasets": ["h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v2"], "inference": false, "thumbnail": "https://h2o.ai/etc.clientlibs/h2o/clientlibs/clientlib-site/resources/images/favicon.ico"}
transformers gpt llm large language model LLaMa en dataset:h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v2 license:other has_space region:us
TAGS
#transformers #gpt #llm #large language model #LLaMa #en #dataset-h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v2 #license-other #has_space #region-us 

h2oGPT Model Card
=================


Summary
-------


URL's 'h2oai/h2ogpt-research-oig-oasst1-512-30b' is a 30 billion parameter instruction-following large language model for research use only.


We provide LORA weights based upon the base model listed below.


* Base model: decapoda-research/llama-30b-hf
* Fine-tuning dataset: h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v2
* Data-prep and fine-tuning code: URL GitHub
* Training logs: zip


The model was trained using h2oGPT code as:


On h2oGPT Hash: 131f6d098b43236b5f91e76fc074ad089d6df368


Only the last checkpoint at epoch 2.0 and step 137,846 is provided in this model repository because the LORA state is large enough and there are enough checkpoints to make total run 19GB. Feel free to request additional checkpoints and we can consider adding more.


Chatbot
-------


* Run your own chatbot: URL GitHub
![URL GitHub](URL


Usage:
------


This 30B model consumes about 66GB of GPU memory, so can operate on a single 80GB GPU or 2 48GB GPUs in 16-bit inference mode, or 1 48GB GPU in 8-bit inference mode. But memory usage depends also on input length, etc.


### Usage as LORA:


Directly use the LORA as:


This will start the chatbot with the LLaMa + LORA pre-loaded. It can also be loaded directly from the gradio app after just doing:


by going to the models tab, adding the model name and LORA name to list, then loading that as the model/lora state.


Choose prompt\_type of 'human\_bot' because that is the way it was instruct fine-tuned.


Here '<lora\_weights\_path>' is a directory of some name that contains the files in this HF model repository:


* adapter\_config.json
* adapter\_model.bin
* special\_tokens\_map.json
* URL
* tokenizer\_config.json


### Build HF model:


One can build an HF compatible model object from the base model and LORA.


Get: URL and change:


where '<lora\_weights\_path>' is same path that includes the files mentioned in last section.


To build the HF model, now just run


Once the HF model is built, to use the model with the 'transformers' library on a machine with GPUs, first make sure you have the 'transformers' and 'accelerate' libraries installed.


Alternatively, if you prefer to not use 'trust\_remote\_code=True' you can download instruct\_pipeline.py and URL,
store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer:


Model Architecture with LORA and flash attention
------------------------------------------------


Model Configuration
-------------------


Model Validation
----------------


Classical benchmarks align with base LLaMa 30B model, but are not useful for conversational purposes. One could use GPT3.5 or GPT4 to evaluate responses, while here we use a RLHF based reward model developed by OpenAssistant to judge human preferences. This is run using h2oGPT:


i.e. with 1 beam. To reproduce, just replace the lora\_weights path with your own path as described in previous sections. Or for native HF models, just pass only base\_model as HF model.


Model: h2oai/h2ogpt-research-oig-oasst1-512-30b, RLHF Mean Score: 0.55, RLHF Median Score: 0.58
Model: OpenAssistant/oasst-sft-7-llama-30b-xor, RLHF Mean Score: 0.51, RLHF Median Score: 0.48
Model: h2oai/h2ogpt-oasst1-512-20b, RLHF Mean Score: 0.49, RLHF Median Score: 0.48
Model: h2oai/h2ogpt-gm-oasst1-en-1024-20b, RLHF Mean Score: 0.43, RLHF Median Score: 0.38
Model: databricks/dolly-v2-12b, RLHF Mean Score: 0.37, RLHF Median Score: 0.27


Logs h2oai/h2ogpt-research-oig-oasst1-512-30b and prompt-response pairs


The full distribution of scores for h2ogpt-research-oig-oasst1-512-30b:


!image info


Same plot for h2oai/h2ogpt-oasst1-512-20b:


!image info


Logs h2oai/h2ogpt-oasst1-512-20b


Ran with 2 beams (1 beam leads to same mean but median of 0.44):


Same plot for h2oai/h2ogpt-gm-oasst1-en-1024-20b:


!image info


Logs h2oai/h2ogpt-gm-oasst1-en-1024-20b


Ran with 2 beams:


Same plot for databricks/dolly-v2-12b:


!image info


Logs databricks/dolly-v2-12b


Disclaimer
----------


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.


* The LORA contained in this repository is only for research (non-commercial) purposes.
* Biases and Offensiveness: The large language model is trained on a diverse range of internet text data, which may contain biased, racist, offensive, or otherwise inappropriate content. By using this model, you acknowledge and accept that the generated content may sometimes exhibit biases or produce content that is offensive or inappropriate. The developers of this repository do not endorse, support, or promote any such content or viewpoints.
* Limitations: The large language model is an AI-based tool and not a human. It may produce incorrect, nonsensical, or irrelevant responses. It is the user's responsibility to critically evaluate the generated content and use it at their discretion.
* Use at Your Own Risk: Users of this large language model must assume full responsibility for any consequences that may arise from their use of the tool. The developers and contributors of this repository shall not be held liable for any damages, losses, or harm resulting from the use or misuse of the provided model.
* Ethical Considerations: Users are encouraged to use the large language model responsibly and ethically. By using this model, you agree not to use it for purposes that promote hate speech, discrimination, harassment, or any form of illegal or harmful activities.
* Reporting Issues: If you encounter any biased, offensive, or otherwise inappropriate content generated by the large language model, please report it to the repository maintainers through the provided channels. Your feedback will help improve the model and mitigate potential issues.
* Changes to this Disclaimer: The developers of this repository reserve the right to modify or update this disclaimer at any time without prior notice. It is the user's responsibility to periodically review the disclaimer to stay informed about any changes.


By using the large language model provided in this repository, you agree to accept and comply with the terms and conditions outlined in this disclaimer. If you do not agree with any part of this disclaimer, you should refrain from using the model and any content generated by it.



### Usage as LORA:


Directly use the LORA as:


This will start the chatbot with the LLaMa + LORA pre-loaded. It can also be loaded directly from the gradio app after just doing:


by going to the models tab, adding the model name and LORA name to list, then loading that as the model/lora state.


Choose prompt\_type of 'human\_bot' because that is the way it was instruct fine-tuned.


Here '<lora\_weights\_path>' is a directory of some name that contains the files in this HF model repository:


* adapter\_config.json
* adapter\_model.bin
* special\_tokens\_map.json
* URL
* tokenizer\_config.json ### Build HF model:


One can build an HF compatible model object from the base model and LORA.


Get: URL and change:


where '<lora\_weights\_path>' is same path that includes the files mentioned in last section.


To build the HF model, now just run


Once the HF model is built, to use the model with the 'transformers' library on a machine with GPUs, first make sure you have the 'transformers' and 'accelerate' libraries installed.


Alternatively, if you prefer to not use 'trust\_remote\_code=True' you can download instruct\_pipeline.py and URL,
store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer:


Model Architecture with LORA and flash attention
------------------------------------------------


Model Configuration
-------------------


Model Validation
----------------


Classical benchmarks align with base LLaMa 30B model, but are not useful for conversational purposes. One could use GPT3.5 or GPT4 to evaluate responses, while here we use a RLHF based reward model developed by OpenAssistant to judge human preferences. This is run using h2oGPT:


i.e. with 1 beam. To reproduce, just replace the lora\_weights path with your own path as described in previous sections. Or for native HF models, just pass only base\_model as HF model.


Model: h2oai/h2ogpt-research-oig-oasst1-512-30b, RLHF Mean Score: 0.55, RLHF Median Score: 0.58
Model: OpenAssistant/oasst-sft-7-llama-30b-xor, RLHF Mean Score: 0.51, RLHF Median Score: 0.48
Model: h2oai/h2ogpt-oasst1-512-20b, RLHF Mean Score: 0.49, RLHF Median Score: 0.48
Model: h2oai/h2ogpt-gm-oasst1-en-1024-20b, RLHF Mean Score: 0.43, RLHF Median Score: 0.38
Model: databricks/dolly-v2-12b, RLHF Mean Score: 0.37, RLHF Median Score: 0.27


Logs h2oai/h2ogpt-research-oig-oasst1-512-30b and prompt-response pairs


The full distribution of scores for h2ogpt-research-oig-oasst1-512-30b:


!image info


Same plot for h2oai/h2ogpt-oasst1-512-20b:


!image info


Logs h2oai/h2ogpt-oasst1-512-20b


Ran with 2 beams (1 beam leads to same mean but median of 0.44):


Same plot for h2oai/h2ogpt-gm-oasst1-en-1024-20b:


!image info


Logs h2oai/h2ogpt-gm-oasst1-en-1024-20b


Ran with 2 beams:


Same plot for databricks/dolly-v2-12b:


!image info


Logs databricks/dolly-v2-12b


Disclaimer
----------


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.


* The LORA contained in this repository is only for research (non-commercial) purposes.
* Biases and Offensiveness: The large language model is trained on a diverse range of internet text data, which may contain biased, racist, offensive, or otherwise inappropriate content. By using this model, you acknowledge and accept that the generated content may sometimes exhibit biases or produce content that is offensive or inappropriate. The developers of this repository do not endorse, support, or promote any such content or viewpoints.
* Limitations: The large language model is an AI-based tool and not a human. It may produce incorrect, nonsensical, or irrelevant responses. It is the user's responsibility to critically evaluate the generated content and use it at their discretion.
* Use at Your Own Risk: Users of this large language model must assume full responsibility for any consequences that may arise from their use of the tool. The developers and contributors of this repository shall not be held liable for any damages, losses, or harm resulting from the use or misuse of the provided model.
* Ethical Considerations: Users are encouraged to use the large language model responsibly and ethically. By using this model, you agree not to use it for purposes that promote hate speech, discrimination, harassment, or any form of illegal or harmful activities.
* Reporting Issues: If you encounter any biased, offensive, or otherwise inappropriate content generated by the large language model, please report it to the repository maintainers through the provided channels. Your feedback will help improve the model and mitigate potential issues.
* Changes to this Disclaimer: The developers of this repository reserve the right to modify or update this disclaimer at any time without prior notice. It is the user's responsibility to periodically review the disclaimer to stay informed about any changes.


By using the large language model provided in this repository, you agree to accept and comply with the terms and conditions outlined in this disclaimer. If you do not agree with any part of this disclaimer, you should refrain from using the model and any content generated by it.
TAGS
#transformers #gpt #llm #large language model #LLaMa #en #dataset-h2oai/h2ogpt-oig-oasst1-instruct-cleaned-v2 #license-other #has_space #region-us 
 ### Usage as LORA:


Directly use the LORA as:


This will start the chatbot with the LLaMa + LORA pre-loaded. It can also be loaded directly from the gradio app after just doing:


by going to the models tab, adding the model name and LORA name to list, then loading that as the model/lora state.


Choose prompt\_type of 'human\_bot' because that is the way it was instruct fine-tuned.


Here '<lora\_weights\_path>' is a directory of some name that contains the files in this HF model repository:


* adapter\_config.json
* adapter\_model.bin
* special\_tokens\_map.json
* URL
* tokenizer\_config.json ### Build HF model:


One can build an HF compatible model object from the base model and LORA.


Get: URL and change:


where '<lora\_weights\_path>' is same path that includes the files mentioned in last section.


To build the HF model, now just run


Once the HF model is built, to use the model with the 'transformers' library on a machine with GPUs, first make sure you have the 'transformers' and 'accelerate' libraries installed.


Alternatively, if you prefer to not use 'trust\_remote\_code=True' you can download instruct\_pipeline.py and URL,
store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer:


Model Architecture with LORA and flash attention
------------------------------------------------


Model Configuration
-------------------


Model Validation
----------------


Classical benchmarks align with base LLaMa 30B model, but are not useful for conversational purposes. One could use GPT3.5 or GPT4 to evaluate responses, while here we use a RLHF based reward model developed by OpenAssistant to judge human preferences. This is run using h2oGPT:


i.e. with 1 beam. To reproduce, just replace the lora\_weights path with your own path as described in previous sections. Or for native HF models, just pass only base\_model as HF model.


Model: h2oai/h2ogpt-research-oig-oasst1-512-30b, RLHF Mean Score: 0.55, RLHF Median Score: 0.58
Model: OpenAssistant/oasst-sft-7-llama-30b-xor, RLHF Mean Score: 0.51, RLHF Median Score: 0.48
Model: h2oai/h2ogpt-oasst1-512-20b, RLHF Mean Score: 0.49, RLHF Median Score: 0.48
Model: h2oai/h2ogpt-gm-oasst1-en-1024-20b, RLHF Mean Score: 0.43, RLHF Median Score: 0.38
Model: databricks/dolly-v2-12b, RLHF Mean Score: 0.37, RLHF Median Score: 0.27


Logs h2oai/h2ogpt-research-oig-oasst1-512-30b and prompt-response pairs


The full distribution of scores for h2ogpt-research-oig-oasst1-512-30b:


!image info


Same plot for h2oai/h2ogpt-oasst1-512-20b:


!image info


Logs h2oai/h2ogpt-oasst1-512-20b


Ran with 2 beams (1 beam leads to same mean but median of 0.44):


Same plot for h2oai/h2ogpt-gm-oasst1-en-1024-20b:


!image info


Logs h2oai/h2ogpt-gm-oasst1-en-1024-20b


Ran with 2 beams:


Same plot for databricks/dolly-v2-12b:


!image info


Logs databricks/dolly-v2-12b


Disclaimer
----------


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.


* The LORA contained in this repository is only for research (non-commercial) purposes.
* Biases and Offensiveness: The large language model is trained on a diverse range of internet text data, which may contain biased, racist, offensive, or otherwise inappropriate content. By using this model, you acknowledge and accept that the generated content may sometimes exhibit biases or produce content that is offensive or inappropriate. The developers of this repository do not endorse, support, or promote any such content or viewpoints.
* Limitations: The large language model is an AI-based tool and not a human. It may produce incorrect, nonsensical, or irrelevant responses. It is the user's responsibility to critically evaluate the generated content and use it at their discretion.
* Use at Your Own Risk: Users of this large language model must assume full responsibility for any consequences that may arise from their use of the tool. The developers and contributors of this repository shall not be held liable for any damages, losses, or harm resulting from the use or misuse of the provided model.
* Ethical Considerations: Users are encouraged to use the large language model responsibly and ethically. By using this model, you agree not to use it for purposes that promote hate speech, discrimination, harassment, or any form of illegal or harmful activities.
* Reporting Issues: If you encounter any biased, offensive, or otherwise inappropriate content generated by the large language model, please report it to the repository maintainers through the provided channels. Your feedback will help improve the model and mitigate potential issues.
* Changes to this Disclaimer: The developers of this repository reserve the right to modify or update this disclaimer at any time without prior notice. It is the user's responsibility to periodically review the disclaimer to stay informed about any changes.


By using the large language model provided in this repository, you agree to accept and comply with the terms and conditions outlined in this disclaimer. If you do not agree with any part of this disclaimer, you should refrain from using the model and any content generated by it.