Views
No views yet

<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
| Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
|---|---|---|---|---|---|
| main | 4 | 128 | German Quad | 8192 | 3.89 GB |
quantization being unrecognised, or other AWQ-related issues, please install vLLM from Github source.--quantization awq parameter, for example:python3 python -m vllm.entrypoints.api_server --model TheBloke/leo-hessianai-7B-chat-AWQ --quantization awq --dtype halfquantization=awq parameter, for example:1from vllm import LLM, SamplingParams
2
3prompts = [
4 "Hello, my name is",
5 "The president of the United States is",
6 "The capital of France is",
7 "The future of AI is",
8]
9sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
10
11llm = LLM(model="TheBloke/leo-hessianai-7B-chat-AWQ", quantization="awq", dtype="half")
12
13outputs = llm.generate(prompts, sampling_params)
14
15# Print the outputs.
16for output in outputs:
17 prompt = output.prompt
18 generated_text = output.outputs[0].text
19 print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}"):latest Docker container: ghcr.io/huggingface/text-generation-inference:latest--quantize awq for AWQ support.--model-id TheBloke/leo-hessianai-7B-chat-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096pip3 install autoawq1pip3 uninstall -y autoawq
2git clone https://github.com/casper-hansen/AutoAWQ
3cd AutoAWQ
4pip3 install .1from awq import AutoAWQForCausalLM
2from transformers import AutoTokenizer
3
4model_name_or_path = "TheBloke/leo-hessianai-7B-chat-AWQ"
5
6# Load model
7model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
8 trust_remote_code=False, safetensors=True)
9tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
10
11prompt = "Tell me about AI"
12prompt_template=f'''<|im_start|>system
13{system_message}<|im_end|>
14<|im_start|>user
15{prompt}<|im_end|>
16<|im_start|>assistant
17
18'''
19
20print("\n\n*** Generate:")
21
22tokens = tokenizer(
23 prompt_template,
24 return_tensors='pt'
25).input_ids.cuda()
26
27# Generate output
28generation_output = model.generate(
29 tokens,
30 do_sample=True,
31 temperature=0.7,
32 top_p=0.95,
33 top_k=40,
34 max_new_tokens=512
35)
36
37print("Output: ", tokenizer.decode(generation_output[0]))
38
39"""
40# Inference should be possible with transformers pipeline as well in future
41# But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
42from transformers import pipeline
43
44print("*** Pipeline:")
45pipe = pipeline(
46 "text-generation",
47 model=model,
48 tokenizer=tokenizer,
49 max_new_tokens=512,
50 do_sample=True,
51 temperature=0.7,
52 top_p=0.95,
53 top_k=40,
54 repetition_penalty=1.1
55)
56
57print(pipe(prompt_template)[0]['generated_text'])
58""":latest Docker container until the next TGI release is made.LeoLM/leo-hessianai-7b and LeoLM/leo-hessianai-13b under the Llama-2 community license (70b also coming soon! 👀).
With this release, we hope to bring a new wave of opportunities to German open-source and commercial LLM research and accelerate adoption.
Read our blog post or our paper (preprint coming soon) for more details!LeoLM/leo-hessianai-7b-chat is a German chat model built on our foundation model LeoLM/leo-hessianai-7b and finetuned on a selection of German instruction datasets.
The model performs exceptionally well on writing, explanation and discussion tasks but struggles somewhat with math and advanced reasoning. See our MT-Bench-DE scores:{
"first_turn": 5.75,
"second_turn": 4.45,
"categories": {
"writing": 5.875,
"roleplay": 6.3,
"reasoning": 3.5,
"math": 2.85,
"coding": 2.95,
"extraction": 4.3,
"stem": 7.4,
"humanities": 7.625
},
"average": 5.1
}pip install transformers torch sentencepiece1pip install packaging ninja
2pip install flash-attn==v2.1.1 --no-build-isolation
3pip install git+https://github.com/HazyResearch/flash-attention.git@v2.1.1#subdirectory=csrc/rotary1from transformers import pipeline
2import torch
3
4system_prompt = """<|im_start|>system
5Dies ist eine Unterhaltung zwischen einem intelligenten, hilfsbereitem KI-Assistenten und einem Nutzer.
6Der Assistent gibt ausführliche, hilfreiche und ehrliche Antworten.<|im_end|>
7
8"""
9prompt_format = "<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
10prompt = "Erkläre mir wie die Fahrradwegesituation in Hamburg ist."
11
12generator = pipeline(model="LeoLM/leo-hessianai-7b-chat", device="cuda", torch_dtype=torch.float16, trust_remote_code=True) # True for flash-attn2 else False
13print(generator(prompt_format.format(prompt=prompt), do_sample=True, top_p=0.95, max_length=8192))"""
<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
"""<|im_start|>user
{prompt 1}<|im_end|>
<|im_start|>assistant
{reply 1}<|im_end|>
<|im_start|>user
{prompt 2}<|im_end|>
<|im_start|>assistant
(...)LeoLM/leo-hessianai-7b-chat cannot be predicted
in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses
to user prompts. Therefore, before deploying any applications of LeoLM/leo-hessianai-7b-chat, developers should
perform safety testing and tuning tailored to their specific applications of the model.| Hyperparameter | Value |
|---|---|
| Num epochs | 3 |
| Examples per epoch | 131214 |
| Global batch size | 256 |
| Learning rate | 3e-5 |
| Warmup steps | 100 |
| LR scheduler | Cosine |
| Adam betas | (0.9, 0.95) |
## Stats for 'Subset of OpenAssistant/OASST-DE' (3534 samples (100.0%))
-----------------
Accepted: 3534/3534 (100.0%)
Accepted tokens: 2259302
Skipped: 0 (0.0%)
Min tokens per sample: 29
Max tokens per sample: 2484
Avg tokens per sample: 639.3044708545557
-----------------
## Stats for 'Subset of FreedomIntelligence/evol-instruct-deutsch' (57841 samples (100.0%))
-----------------
Accepted: 57841/57841 (100.0%)
Accepted tokens: 42958192
Skipped: 0 (0.0%)
Min tokens per sample: 33
Max tokens per sample: 5507
Avg tokens per sample: 742.6944900675991
-----------------
## Stats for 'Subset of FreedomIntelligence/alpaca-gpt4-deutsch' (48969 samples (100.0%))
-----------------
Accepted: 48969/48969 (100.0%)
Accepted tokens: 13372005
Skipped: 0 (0.0%)
Min tokens per sample: 19
Max tokens per sample: 1359
Avg tokens per sample: 273.07082031489307
-----------------
## Stats for 'Subset of LeoLM/OpenSchnabeltier' (21314 samples (100.0%))
-----------------
Accepted: 21314/21314 (100.0%)
Accepted tokens: 8134690
Skipped: 0 (0.0%)
Min tokens per sample: 25
Max tokens per sample: 1202
Avg tokens per sample: 381.65947264708643
-----------------
## Stats for 'Subset of LeoLM/German_Poems' (490 samples (100.0%))
-----------------
Accepted: 490/490 (100.0%)
Accepted tokens: 618642
Skipped: 0 (0.0%)
Min tokens per sample: 747
Max tokens per sample: 1678
Avg tokens per sample: 1262.534693877551
-----------------
## Stats for 'Subset of LeoLM/German_Songs' (392 samples (100.0%))
-----------------
Accepted: 392/392 (100.0%)
Accepted tokens: 187897
Skipped: 0 (0.0%)
Min tokens per sample: 231
Max tokens per sample: 826
Avg tokens per sample: 479.3290816326531
-----------------
## Stats for 'total' (132540 samples (100.0%))
-----------------
Accepted: 132540/132540 (100.0%)
Accepted tokens: 67530728
Skipped: 0 (0.0%)
Min tokens per sample: 19
Max tokens per sample: 5507
Avg tokens per sample: 509.51205673758864
-----------------