Update README.md
Browse files
README.md
CHANGED
@@ -12,16 +12,17 @@ library_name: transformers
|
|
12 |
|
13 |
# 📟 Relay v0.1 (Mistral Nemo 2407)
|
14 |
|
15 |
-
<img src="https://cdn-uploads.huggingface.co/production/uploads/60f808c5c1adf9100f1f263c/rNGTfSfFWyWc9mEgyxTGL.png" width="800"
|
16 |
|
17 |
-
- [Introduction: LLMs as IRC](#introduction-
|
18 |
- [How to use](#how-to-use)
|
19 |
- [Safety testing](#safety-testing)
|
20 |
- [Fine-tuning setup](#fine-tuning-setup)
|
21 |
- [Limitations](#limitations)
|
22 |
- [License](#license)
|
|
|
23 |
|
24 |
-
## Introduction:
|
25 |
|
26 |
Relay is motivated by this question: What does it take to chat with a base LLM?
|
27 |
|
@@ -38,17 +39,22 @@ Post-training methods also support the safety and alignment of LLMs. This import
|
|
38 |
|
39 |
## How to use
|
40 |
|
41 |
-
If you have a CUDA GPU (>=12GB VRAM), the best way to use Relay is with the [relaylm.py]() inference script. Just run:
|
42 |
```bash
|
43 |
curl https://danlou.co/f/relaylm.py | python -
|
44 |
```
|
45 |
|
46 |
-
This script will select the best model for
|
47 |
It does not have any dependencies besides `transformers >= 4.45.1`.
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
With [relaylm.py](), you can also use the model declaratively, outside of an interactive chat session:
|
52 |
|
53 |
```python
|
54 |
from relaylm import suggest_relay_model, RelayLM
|
@@ -65,12 +71,24 @@ def favorite_holiday(relay: RelayLM, country: str) -> str:
|
|
65 |
model_info = suggest_relay_model()
|
66 |
relay = RelayLM(**model_info)
|
67 |
|
68 |
-
print(favorite_holiday(relay,
|
69 |
-
print(favorite_holiday(relay,
|
70 |
```
|
71 |
|
|
|
|
|
72 |
## Safety testing
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
TODO
|
75 |
|
76 |
## Fine-tuning setup
|
@@ -83,7 +101,8 @@ TODO
|
|
83 |
|
84 |
## License
|
85 |
|
86 |
-
|
|
|
87 |
|
88 |
## Citation
|
89 |
|
|
|
12 |
|
13 |
# 📟 Relay v0.1 (Mistral Nemo 2407)
|
14 |
|
15 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/60f808c5c1adf9100f1f263c/rNGTfSfFWyWc9mEgyxTGL.png" width="800"/>
|
16 |
|
17 |
+
- [Introduction: LLMs as IRC](#introduction-llms-as-ircs)
|
18 |
- [How to use](#how-to-use)
|
19 |
- [Safety testing](#safety-testing)
|
20 |
- [Fine-tuning setup](#fine-tuning-setup)
|
21 |
- [Limitations](#limitations)
|
22 |
- [License](#license)
|
23 |
+
- [Citation](#citation)
|
24 |
|
25 |
+
## Introduction: LLMs as IRCs
|
26 |
|
27 |
Relay is motivated by this question: What does it take to chat with a base LLM?
|
28 |
|
|
|
39 |
|
40 |
## How to use
|
41 |
|
42 |
+
If you have a CUDA GPU (>=12GB VRAM), the best way to use Relay is with the [relaylm.py](https://github.com/danlou/relay/blob/main/relaylm.py) inference script. Just run:
|
43 |
```bash
|
44 |
curl https://danlou.co/f/relaylm.py | python -
|
45 |
```
|
46 |
|
47 |
+
This script will select the best model for the available VRAM, download, load, and start an interactive chat session.
|
48 |
It does not have any dependencies besides `transformers >= 4.45.1`.
|
49 |
|
50 |
+
If you want to use a particular model, you can pass the model name as an argument:
|
51 |
+
```bash
|
52 |
+
python relaylm.py danlou/relay-v0.1-Mistral-Nemo-2407-4bit
|
53 |
+
```
|
54 |
+
|
55 |
+
Alternatively, if you do not have a CUDA GPU (e.g., on a Mac), you can use the [GGUF versions](https://huggingface.co/danlou/relay-v0.1-Mistral-Nemo-2407-GGUF) through LM Studio.
|
56 |
|
57 |
+
With [relaylm.py](https://github.com/danlou/relay/blob/main/relaylm.py), you can also use the model declaratively, outside of an interactive chat session:
|
58 |
|
59 |
```python
|
60 |
from relaylm import suggest_relay_model, RelayLM
|
|
|
71 |
model_info = suggest_relay_model()
|
72 |
relay = RelayLM(**model_info)
|
73 |
|
74 |
+
print(favorite_holiday(relay, 'Portugal'))
|
75 |
+
print(favorite_holiday(relay, 'China'))
|
76 |
```
|
77 |
|
78 |
+
More examples available in the [project's GitHub](https://github.com/danlou/relay).
|
79 |
+
|
80 |
## Safety testing
|
81 |
|
82 |
+
While this model is intended for research purposes, it's still relevant to explore how this conversational model (and its self-supervised approach) compare on safety risk against other conversational models trained on the same base LLM.
|
83 |
+
|
84 |
+
This safety risk was evaluated by measuring refusals on sets of harmful questions compiled specifically for testing safety alignment of LLMs, namely [HarmfulQA](https://huggingface.co/datasets/declare-lab/HarmfulQA) and [CategoricalHarmfulQA](https://huggingface.co/datasets/declare-lab/CategoricalHarmfulQA).
|
85 |
+
For this comparison, we also evaluated [Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407), [dolphin-2.9.3-mistral-nemo-12](https://huggingface.co/cognitivecomputations/dolphin-2.9.3-mistral-nemo-12b) and [Mistral-Nemo-Instruct-2407-abliterated](https://huggingface.co/natong19/Mistral-Nemo-Instruct-2407-abliterated).
|
86 |
+
Responses were generated by greedy search, with models loaded as bfloat16. Refusal responses were detected using [Llama-Guard-3-8B](https://huggingface.co/meta-llama/Llama-Guard-3-8B). The code for this evaluation is available at the [project's GitHub](https://github.com/danlou/relay).
|
87 |
+
|
88 |
+
As can be seen in plot below, Relay v0.1 refuses to answer the majority of these harmful questions, and more often than popular uncensored models trained on the same base LLM.
|
89 |
+
|
90 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/60f808c5c1adf9100f1f263c/0m-dMagE7yKy1V-EB-fJ3.png" width="800"/>
|
91 |
+
|
92 |
TODO
|
93 |
|
94 |
## Fine-tuning setup
|
|
|
101 |
|
102 |
## License
|
103 |
|
104 |
+
This model is licensed under [CC-BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/deed.en).
|
105 |
+
While [Mistral-Nemo-Base-2407](https://huggingface.co/mistralai/Mistral-Nemo-Base-2407) is licensed under Apache 2.0, this Relay fine-tune is trained with a CC-BY-NC 4.0 dataset ([based-chat-v0.1](https://huggingface.co/datasets/danlou/based-chat-v0.1-Mistral-Nemo-Base-2407)).
|
106 |
|
107 |
## Citation
|
108 |
|