File size: 3,460 Bytes
a467bf1
 
 
 
 
 
 
 
 
 
1e7798c
da9f087
14b793b
c71fc74
1e7798c
a11d9ce
9ba59e7
 
 
 
 
bbd10e2
2c1a704
 
 
9ba59e7
 
 
 
 
 
 
 
 
 
dcf10e9
9ba59e7
 
 
a11d9ce
 
9ba59e7
 
dec36b9
d3e86d8
1e7798c
52bdebe
bbd10e2
52bdebe
 
 
 
 
 
 
 
 
 
 
 
 
dcf10e9
52bdebe
4e6bc41
52bdebe
 
00864c1
 
52bdebe
 
f4b77c9
a467bf1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5a890da
dec36b9
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
base_model:
- BioMistral/BioMistral-7B
- timpal0l/Mistral-7B-v0.1-flashback-v2-instruct
library_name: transformers
tags:
- mergekit
- merge

---
# Eir
<img src="eir.png" width="100%" height="auto">

*Eir är läkekonstens gudinna i nordisk mytologi.*

## How to use
```python
from transformers import AutoTokenizer
import transformers
import torch

model = "birgermoell/eir"
messages = [
      {"role": "system", "content": "Du är en läkare som är expert i allmänmedicin: Svara på följande fråga:"},
      {"role": "user", "content": "Vad ska jag göra om jag är förkyld?"}]

tokenizer = AutoTokenizer.from_pretrained(model)
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    torch_dtype=torch.float16,
    device_map="auto",
)

outputs = pipeline(prompt, max_new_tokens=512, do_sample=False, temperature=0.7, top_k=50, top_p=0.95, repetition_penalty=1.2)
print(outputs[0]["generated_text"])
```

```python
>>> "Om du är förkyld är det viktigt att vila och dricka mycket vatten.
Om du har feber, kan du ta paracetamol eller ibuprofen.
Om du har svårare symptom som svår feber, svårare smärtor i halsen,
svårare svullnad i halsen, svårare svårigheter att andas, kan du behöva söka hjälp hos en läkare."
```

```python
model = "birgermoell/eir"
messages = [
    {"role": "system", "content": "Du är en läkare som är expert i allmänmedicin: Svara på följande fråga:"},
    {"role": "user", "content": "Jag har ont i magen, hur vet jag om jag ska besöka en läkare?"}]

tokenizer = AutoTokenizer.from_pretrained(model)
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    torch_dtype=torch.float16,
    device_map="auto",
)

outputs = pipeline(prompt, max_new_tokens=512, do_sample=False, temperature=0.7, top_k=50, top_p=0.95, repetition_penalty=1.2)
print(outputs[0]["generated_text"])
```

```python
>>> "Om du har ont i magen som är svår att förklara, varar längre än tre veckor, eller är kombinerat med andra symtom som viktigast, feber, diarré, blod i avföringen,
minskad aptit, viktförlust, gastroesophageal reflux, nausea, kräkningar, eller svårigheter att svälja, bör du söka hjälp av en läkare."
```

This model is a merge of https://huggingface.co/timpal0l/Mistral-7B-v0.1-flashback-v2-instruct and https://huggingface.co/BioMistral/BioMistral-7B.

### Configuration

The following YAML configuration was used to produce this model:

```yaml
models:
  - model: timpal0l/Mistral-7B-v0.1-flashback-v2-instruct
    # No parameters necessary for base model
  - model: BioMistral/BioMistral-7B
    parameters:
      density: 0.53
      weight: 0.6
merge_method: dare_ties
base_model: timpal0l/Mistral-7B-v0.1-flashback-v2-instruct
parameters:
  int8_mask: true
dtype: bfloat16
```

## CAUTION! 
Both direct and downstream users need to be informed about the risks, biases, and constraints inherent in the model. While the model can produce natural language text, our exploration of its capabilities and limitations is just beginning. In fields such as medicine, comprehending these limitations is crucial. Hence, we strongly advise against deploying this model for natural language generation in production or for professional tasks in the realm of health and medicine.