File size: 5,828 Bytes
1e5240a ef52388 1e5240a 157d912 1e5240a 157d912 1e5240a 155eed6 c226cfc 1e5240a c226cfc 1e5240a c226cfc 1e5240a c226cfc 1e5240a c226cfc 1e5240a c226cfc 1e5240a 157d912 c226cfc 157d912 c226cfc 157d912 c226cfc 157d912 1e5240a 4c75f09 1e5240a |
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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
---
license: apache-2.0
language:
- el
- en
tags:
- finetuned
- quantized
- awq
inference: true
pipeline_tag: text-generation
---
# Meltemi Instruct Large Language Model for the Greek language (4-bit AWQ quantization)
We present Meltemi-7B-Instruct-v1 Large Language Model (LLM), an instruct fine-tuned version of [Meltemi-7B-v1](https://huggingface.co/ilsp/Meltemi-7B-v1).
The quantized version was produced using [AutoAWQ](https://github.com/casper-hansen/AutoAWQ).
# Instruction format
The prompt format is the same as the [Zephyr](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) format:
```
<s><|system|>
Είσαι το Μελτέμι, ένα γλωσσικό μοντέλο για την ελληνική γλώσσα. Είσαι ιδιαίτερα βοηθητικό προς την χρήστρια ή τον χρήστη και δίνεις σύντομες αλλά επαρκώς περιεκτικές απαντήσεις. Απάντα με προσοχή, ευγένεια, αμεροληψία, ειλικρίνεια και σεβασμό προς την χρήστρια ή τον χρήστη.</s>
<|user|>
Πες μου αν έχεις συνείδηση.</s>
<|assistant|>
```
# Using the model with Huggingface
First you need to install the dependencies
```
pip install autoawq transformers
```
The quantized model can be utilized through the tokenizer's [chat template](https://huggingface.co/docs/transformers/main/chat_templating) functionality as follows:
```python
from awq import AutoAWQForCausalLM
from transformers import AutoTokenizer
device = "cuda" # the device to load the model onto
model = AutoAWQForCausalLM.from_quantized(
"ilsp/Meltemi-7B-Instruct-v1-AWQ",
fuse_layers=True,
trust_remote_code=False,
safetensors=True
)
tokenizer = AutoTokenizer.from_pretrained(
"ilsp/Meltemi-7B-Instruct-v1-AWQ",
trust_remote_code=False
)
model.to(device)
messages = [
{"role": "system", "content": "Είσαι το Μελτέμι, ένα γλωσσικό μοντέλο για την ελληνική γλώσσα. Είσαι ιδιαίτερα βοηθητικό προς την χρήστρια ή τον χρήστη και δίνεις σύντομες αλλά επαρκώς περιεκτικές απαντήσεις. Απάντα με προσοχή, ευγένεια, αμεροληψία, ειλικρίνεια και σεβασμό προς την χρήστρια ή τον χρήστη."},
{"role": "user", "content": "Πες μου αν έχεις συνείδηση."},
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
input_prompt = tokenizer(prompt, add_special_tokens=True, return_tensors="pt").input_ids.to("cuda")
outputs = model.generate(input_prompt, max_new_tokens=256, do_sample=True)
print(tokenizer.batch_decode(outputs)[0])
# Ως μοντέλο γλώσσας AI, δεν έχω τη δυνατότητα να αντιληφθώ ή να βιώσω συναισθήματα όπως η συνείδηση ή η επίγνωση. Ωστόσο, μπορώ να σας βοηθήσω με οποιεσδήποτε ερωτήσεις μπορεί να έχετε σχετικά με την τεχνητή νοημοσύνη και τις εφαρμογές της.
messages.extend([
{"role": "assistant", "content": tokenizer.batch_decode(outputs)[0]},
{"role": "user", "content": "Πιστεύεις πως οι άνθρωποι πρέπει να φοβούνται την τεχνητή νοημοσύνη;"}
])
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
input_prompt = tokenizer(prompt, add_special_tokens=True, return_tensors="pt").input_ids.to("cuda")
outputs = model.generate(input_prompt, max_new_tokens=256, do_sample=True)
print(tokenizer.batch_decode(outputs)[0])
```
# Using the model with vLLM
Install vLLM
```
pip install vllm
```
Then use from python API:
```python
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained(
"ilsp/Meltemi-7B-Instruct-v1-AWQ",
trust_remote_code=False
)
prompts = [
[
{"role": "system", "content": "Είσαι το Μελτέμι, ένα γλωσσικό μοντέλο για την ελληνική γλώσσα. Είσαι ιδιαίτερα βοηθητικό προς την χρήστρια ή τον χρήστη και δίνεις σύντομες αλλά επαρκώς περιεκτικές απαντήσεις. Απάντα με προσοχή, ευγένεια, αμεροληψία, ειλικρίνεια και σεβασμό προς την χρήστρια ή τον χρήστη."},
{"role": "user", "content": "Πες μου αν έχεις συνείδηση."},
]
]
# add bos token since apply_chat_template does not include it automatically
prompts = ["<s>" + tokenizer.apply_chat_template(p, add_generation_prompt=True, tokenize=False) for p in prompts]
sampling_params = SamplingParams(temperature=0.8, top_p=0.95, max_tokens=256)
llm = LLM(model="ilsp/Meltemi-7B-Instruct-v1-AWQ", tokenizer="ilsp/Meltemi-7B-Instruct-v1-AWQ", quantization="awq")
outputs = llm.generate(prompts, sampling_params)
for output in outputs:
prompt = output.prompt
generated_text = output.outputs[0].text
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
```
# Ethical Considerations
This model has not been aligned with human preferences, and therefore might generate misleading, harmful, or toxic content.
# Acknowledgements
The ILSP team utilized Amazon’s cloud computing services, which were made available via GRNET under the [OCRE Cloud framework](https://www.ocre-project.eu/), providing Amazon Web Services for the Greek Academic and Research Community.
|