Upload 7 files
Browse files- README.md +114 -1
- adapter_config.json +18 -0
- adapter_model.bin +3 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +6 -0
- tokenizer.model +3 -0
- tokenizer_config.json +8 -0
README.md
CHANGED
@@ -1,3 +1,116 @@
|
|
1 |
---
|
2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: bigscience-openrail-m
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
inference: false
|
6 |
+
tags:
|
7 |
+
- trl
|
8 |
+
- transformers
|
9 |
+
- rlhf
|
10 |
+
datasets:
|
11 |
+
- lvwerra/stack-exchange-paired
|
12 |
---
|
13 |
+
|
14 |
+
![pull_figure](https://huggingface.co/datasets/trl-internal-testing/example-images/resolve/main/images/stack-llama.png)
|
15 |
+
|
16 |
+
# Llama-se-rl-peft
|
17 |
+
Adapter weights of a Reinforcement Learning fine-tuned model based on the LLaMA model (see [Meta's LLaMA release](https://ai.facebook.com/blog/large-language-model-llama-meta-ai) for the original LLaMA model).
|
18 |
+
The model is designed to generate human-like responses to questions in Stack Exchange domains of programming, mathematics, physics, and more.
|
19 |
+
For more info check out the [blog post](https://huggingface.co/blog/stackllama) and [github example](https://github.com/lvwerra/trl/tree/main/examples/stack_llama/scripts).
|
20 |
+
|
21 |
+
## Model Details
|
22 |
+
|
23 |
+
### Model Description
|
24 |
+
**Developed by:** Hugging Face
|
25 |
+
|
26 |
+
**Model type:** An auto-regressive language model based on the transformer architecture, and fine-tuned with [Stack Exchange datasets](https://huggingface.co/datasets/lvwerra/stack-exchange-paired).
|
27 |
+
|
28 |
+
**Languages:** Predominantly English, with additional data from languages with the following ISO codes:
|
29 |
+
|
30 |
+
| bg | ca | cs | da | de | es | fr | hr | hu | it | nl | pl | pt | ro | ru | sl | sr | sv | uk |
|
31 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
32 |
+
|
33 |
+
|
34 |
+
**License:** [bigscience-openrail-m](https://drive.google.com/file/d/16NqKiAkzyZ55NClubCIFup8pT2jnyVIo/view?usp=sharing)
|
35 |
+
|
36 |
+
**Finetuned from:** [LLaMA](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md)
|
37 |
+
|
38 |
+
### Model Sources
|
39 |
+
**Repository:** [https://huggingface.co/trl-lib/llama-7b-se-rl-peft/tree/main](https://huggingface.co/trl-lib/llama-7b-se-rl-peft/tree/main)
|
40 |
+
|
41 |
+
**Base Model Repository:** [https://github.com/facebookresearch/llama](https://github.com/facebookresearch/llama)
|
42 |
+
|
43 |
+
**Demo:** [https://huggingface.co/spaces/trl-lib/stack-llama](https://huggingface.co/spaces/trl-lib/stack-llama)
|
44 |
+
|
45 |
+
## Uses
|
46 |
+
|
47 |
+
### Direct Use
|
48 |
+
- Long-form question-answering on topics of programming, mathematics, and physics
|
49 |
+
- Demonstrating a Large Language Model's ability to follow target behavior of generating answers to a question that would be highly rated on [Stack Exchange](https://stackexchange.com).
|
50 |
+
|
51 |
+
### Out of Scope Use
|
52 |
+
- Replacing human expertise
|
53 |
+
|
54 |
+
|
55 |
+
## Bias, Risks, and Limitations
|
56 |
+
- Inherits bias, risks, and limitations from the LLaMA model, as described in the [LLaMA Model Card Bias Evaluation](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md#quantitative-analysis) and [Ethical Considerations](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md#ethical-considerations).
|
57 |
+
- Retains biases present in the Stack Exchange dataset. Per the [latest developer survey for Stack Overflow](https://survey.stackoverflow.co/2022/),
|
58 |
+
which constitutes a significant part of the StackExchange data,
|
59 |
+
most users who answered the survey identified themselves as [White or European, men, between 25 and 34 years old, and based in the US (with a significant part of responders from India).](https://survey.stackoverflow.co/2022/#developer-profile-demographics)
|
60 |
+
- May generate answers that are incorrect or misleading.
|
61 |
+
- May copy answers from the training data verbatim.
|
62 |
+
- May generate language that is hateful or promotes discrimination ([example](https://huggingface.co/trl-lib/llama-7b-se-rl-peft/discussions/7#64376083369f6f907f5bfe4c)).
|
63 |
+
- May generate language that is offensive to direct or indirect users or to people or groups mentioned.
|
64 |
+
|
65 |
+
|
66 |
+
### Recommendations
|
67 |
+
- Answers should be validated through the use of external sources.
|
68 |
+
- Disparities between the data contributors and the direct and indirect users of the technology should inform developers in assessing what constitutes an appropriate use case.
|
69 |
+
- Further research is needed to attribute model generations to sources in the training data, especially in cases where the model copies answers from the training data.
|
70 |
+
|
71 |
+
## Training Details
|
72 |
+
|
73 |
+
### Training Data
|
74 |
+
Original datasets are described in [the LLaMA Model Card](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md#training-dataset).
|
75 |
+
Fine-tuning datasets for this model are based on [Stack Exchange Paired](https://huggingface.co/datasets/lvwerra/stack-exchange-paired), which consists of questions and answers from various domains in Stack Exchange, such as programming, mathematics, physics, and more. Specifically:
|
76 |
+
|
77 |
+
**Traditional Fine-tuning:** [https://huggingface.co/datasets/lvwerra/stack-exchange-paired/tree/main/data/finetune](https://huggingface.co/datasets/lvwerra/stack-exchange-paired/tree/main/data/finetune)
|
78 |
+
|
79 |
+
**RL Fine-tuning:** [https://huggingface.co/datasets/lvwerra/stack-exchange-paired/tree/main/data/rl](https://huggingface.co/datasets/lvwerra/stack-exchange-paired/tree/main/data/rl)
|
80 |
+
|
81 |
+
**Reward Model:** [https://huggingface.co/trl-lib/llama-7b-se-rm-peft](https://huggingface.co/trl-lib/llama-7b-se-rm-peft)
|
82 |
+
|
83 |
+
### Training Procedure
|
84 |
+
The model was first fine-tuned on the Stack Exchange question and answer pairs and then RL fine-tuned using a Stack Exchange Reward Model.
|
85 |
+
It is trained to respond to prompts with the following template:
|
86 |
+
|
87 |
+
```
|
88 |
+
Question: <Query>
|
89 |
+
|
90 |
+
Answer: <Response>
|
91 |
+
```
|
92 |
+
|
93 |
+
|
94 |
+
## Citation
|
95 |
+
|
96 |
+
**BibTeX:**
|
97 |
+
```
|
98 |
+
@misc {beeching2023stackllama,
|
99 |
+
author = { Edward Beeching and
|
100 |
+
Younes Belkada and
|
101 |
+
Kashif Rasul and
|
102 |
+
Lewis Tunstall and
|
103 |
+
Leandro von Werra and
|
104 |
+
Nazneen Rajani and
|
105 |
+
Nathan Lambert
|
106 |
+
},
|
107 |
+
title = { StackLLaMa: An RL Fine-tuned LLaMa Model for Stack Exchange Question and Answering },
|
108 |
+
year = 2023,
|
109 |
+
url = { https://huggingface.co/trl-lib/llama-7b-se-rl-peft },
|
110 |
+
doi = { 10.57967/hf/0513 },
|
111 |
+
publisher = { Hugging Face Blog }
|
112 |
+
}
|
113 |
+
```
|
114 |
+
|
115 |
+
## Model Card Authors
|
116 |
+
[Nathan Lambert](https://huggingface.co/natolambert), [Leandro von Werra](https://huggingface.co/lvwerra), [Edward Beeching](https://huggingface.co/edbeeching), [Kashif Rasul](https://huggingface.co/kashif), [Younes Belkada](https://huggingface.co/ybelkada), [Margaret Mitchell](https://huggingface.co/meg)
|
adapter_config.json
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"base_model_name_or_path": "trl-lib/llama-se-merged",
|
3 |
+
"bias": "none",
|
4 |
+
"enable_lora": null,
|
5 |
+
"fan_in_fan_out": false,
|
6 |
+
"inference_mode": true,
|
7 |
+
"lora_alpha": 32,
|
8 |
+
"lora_dropout": 0.05,
|
9 |
+
"merge_weights": false,
|
10 |
+
"modules_to_save": null,
|
11 |
+
"peft_type": "LORA",
|
12 |
+
"r": 16,
|
13 |
+
"target_modules": [
|
14 |
+
"q_proj",
|
15 |
+
"v_proj"
|
16 |
+
],
|
17 |
+
"task_type": "CAUSAL_LM"
|
18 |
+
}
|
adapter_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e90eae24a9d0992ff9271c648d5a2a07ba2b4f23877da1a2ae70f4635afcc1dd
|
3 |
+
size 33600461
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:84ef5d11766acdf820ca5f23eb77373b3091c105845d69b8821af40581ca9c69
|
3 |
+
size 17471
|
special_tokens_map.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "</s>",
|
3 |
+
"eos_token": "</s>",
|
4 |
+
"pad_token": "[PAD]",
|
5 |
+
"unk_token": "</s>"
|
6 |
+
}
|
tokenizer.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
3 |
+
size 499723
|
tokenizer_config.json
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "",
|
3 |
+
"eos_token": "",
|
4 |
+
"model_max_length": 1000000000000000019884624838656,
|
5 |
+
"special_tokens_map_file": "/home/sgugger/tmp/llama/llama-7b-tmp/tokenizer/special_tokens_map.json",
|
6 |
+
"tokenizer_class": "LlamaTokenizer",
|
7 |
+
"unk_token": ""
|
8 |
+
}
|