Update README.md
Browse files
README.md
CHANGED
|
@@ -51,10 +51,37 @@ pipeline_tag: text-generation
|
|
| 51 |
{Assistant}
|
| 52 |
```
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
## Hardware and Software
|
| 55 |
|
| 56 |
-
* **Hardware**: We utilized an A100x8 for training our model
|
| 57 |
-
* **Training Factors**: We fine-tuned this model using a combination of the [DeepSpeed library](https://github.com/microsoft/DeepSpeed) and the [HuggingFace
|
| 58 |
|
| 59 |
## Evaluation Results
|
| 60 |
|
|
@@ -75,15 +102,13 @@ We used the [lm-evaluation-harness repository](https://github.com/EleutherAI/lm-
|
|
| 75 |
| llama-65b | 64.2 | 63.5 | 86.1 | 63.9 | 43.4 | | |
|
| 76 |
| falcon-40b-instruct | 63.4 | 61.6 | 84.3 | 55.4 | 52.5 | | |
|
| 77 |
|
| 78 |
-
### Scripts
|
| 79 |
- Prepare evaluation environments:
|
| 80 |
```
|
| 81 |
# clone the repository
|
| 82 |
git clone https://github.com/EleutherAI/lm-evaluation-harness.git
|
| 83 |
-
|
| 84 |
# check out the specific commit
|
| 85 |
git checkout b281b0921b636bc36ad05c0b0b0763bd6dd43463
|
| 86 |
-
|
| 87 |
# change to the repository directory
|
| 88 |
cd lm-evaluation-harness
|
| 89 |
```
|
|
|
|
| 51 |
{Assistant}
|
| 52 |
```
|
| 53 |
|
| 54 |
+
## Usage
|
| 55 |
+
|
| 56 |
+
- Tested on A100 80GB
|
| 57 |
+
- Our model can handle up to 10k input tokens, thanks to the `rope_scaling` option
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
import torch
|
| 61 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
| 62 |
+
|
| 63 |
+
tokenizer = AutoTokenizer.from_pretrained("upstage/llama-30b-instruct")
|
| 64 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 65 |
+
"upstage/llama-30b-instruct",
|
| 66 |
+
device_map="auto",
|
| 67 |
+
torch_dtype=torch.float16,
|
| 68 |
+
load_in_8bit=True,
|
| 69 |
+
rope_scaling={"type": "dynamic", "factor": 2} # allows handling of longer inputs
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
prompt = "### User:\nThomas is healthy, but he has to go to the hospital. What could be the reasons?\n\n### Assistant:\n"
|
| 73 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 74 |
+
del inputs["token_type_ids"]
|
| 75 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
| 76 |
+
|
| 77 |
+
output = model.generate(**inputs, streamer=streamer, use_cache=True, max_new_tokens=float('inf'))
|
| 78 |
+
output_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
## Hardware and Software
|
| 82 |
|
| 83 |
+
* **Hardware**: We utilized an A100x8 * 4 for training our model
|
| 84 |
+
* **Training Factors**: We fine-tuned this model using a combination of the [DeepSpeed library](https://github.com/microsoft/DeepSpeed) and the [HuggingFace Trainer](https://huggingface.co/docs/transformers/main_classes/trainer) / [HuggingFace Accelerate](https://huggingface.co/docs/accelerate/index)
|
| 85 |
|
| 86 |
## Evaluation Results
|
| 87 |
|
|
|
|
| 102 |
| llama-65b | 64.2 | 63.5 | 86.1 | 63.9 | 43.4 | | |
|
| 103 |
| falcon-40b-instruct | 63.4 | 61.6 | 84.3 | 55.4 | 52.5 | | |
|
| 104 |
|
| 105 |
+
### Scripts for H4 Score Reproduction
|
| 106 |
- Prepare evaluation environments:
|
| 107 |
```
|
| 108 |
# clone the repository
|
| 109 |
git clone https://github.com/EleutherAI/lm-evaluation-harness.git
|
|
|
|
| 110 |
# check out the specific commit
|
| 111 |
git checkout b281b0921b636bc36ad05c0b0b0763bd6dd43463
|
|
|
|
| 112 |
# change to the repository directory
|
| 113 |
cd lm-evaluation-harness
|
| 114 |
```
|