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 | 4096 | 4.15 GB |
TheBloke/Leo-Mistral-Hessianai-7B-Chat-AWQ.Leo-Mistral-Hessianai-7B-Chat-AWQ--quantization awq parameter.--dtype float16.python3 python -m vllm.entrypoints.api_server --model TheBloke/Leo-Mistral-Hessianai-7B-Chat-AWQ --quantization awq --dtype float16quantization=awq and dtype=float16 parameters.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-Mistral-Hessianai-7B-Chat-AWQ", quantization="awq", dtype="float16")
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}")ghcr.io/huggingface/text-generation-inference:1.1.0--model-id TheBloke/Leo-Mistral-Hessianai-7B-Chat-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096pip3 install huggingface-hub1from huggingface_hub import InferenceClient
2
3endpoint_url = "https://your-endpoint-url-here"
4
5prompt = "Tell me about AI"
6prompt_template=f'''<|im_start|>system
7{system_message}<|im_end|>
8<|im_start|>user
9{prompt}<|im_end|>
10<|im_start|>assistant
11
12'''
13
14client = InferenceClient(endpoint_url)
15response = client.text_generation(prompt,
16 max_new_tokens=128,
17 do_sample=True,
18 temperature=0.7,
19 top_p=0.95,
20 top_k=40,
21 repetition_penalty=1.1)
22
23print(f"Model output: {response}")pip3 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-Mistral-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
19print("\n\n*** Generate:")
20
21tokens = tokenizer(
22 prompt_template,
23 return_tensors='pt'
24).input_ids.cuda()
25
26# Generate output
27generation_output = model.generate(
28 tokens,
29 do_sample=True,
30 temperature=0.7,
31 top_p=0.95,
32 top_k=40,
33 max_new_tokens=512
34)
35
36print("Output: ", tokenizer.decode(generation_output[0]))
37
38"""
39# Inference should be possible with transformers pipeline as well in future
40# But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
41from transformers import pipeline
42
43print("*** Pipeline:")
44pipe = pipeline(
45 "text-generation",
46 model=model,
47 tokenizer=tokenizer,
48 max_new_tokens=512,
49 do_sample=True,
50 temperature=0.7,
51 top_p=0.95,
52 top_k=40,
53 repetition_penalty=1.1
54)
55
56print(pipe(prompt_template)[0]['generated_text'])
57"""Loader: AutoAWQLeoLM/leo-mistral-hessianai-7b under Apache 2.0 and 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-mistral-hessianai-7b-chat is a German chat model built on our foundation model LeoLM/leo-mistral-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": 6.1,
"second_turn": 4.7,
"categories": {
"writing": 6.8,
"roleplay": 6.35,
"reasoning": 3.3,
"math": 2.75,
"coding": 4.4,
"extraction": 4.5,
"stem": 6.85,
"humanities": 8.25
},
"average": 5.4
}pip install transformers torch sentencepiece1pip install packaging ninja
2pip install flash-attn1from 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-mistral-hessianai-7b-chat", device="cuda", torch_dtype=torch.float16, use_flash_attention_2=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-mistral-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-mistral-hessianai-7b-chat, developers should
perform safety testing and tuning tailored to their specific applications of the model.| Hyperparameter | Value |
|---|---|
| Num epochs | 4 |
| Examples per epoch | 131214 |
| Global batch size | 256 |
| Learning rate | 1e-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
-----------------