Views
No views yet

### System:
{system_message}
### User:
{prompt}
### Assistant:
--quantization awq parameter, for example:python3 python -m vllm.entrypoints.api_server --model TheBloke/StableBeluga2-70B-AWQ --quantization awqquantization=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/StableBeluga2-70B-AWQ", quantization="awq")
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}")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/StableBeluga2-70B-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'''### System:
13{system_message}
14
15### User:
16{prompt}
17
18### Assistant:
19
20'''
21
22print("\n\n*** Generate:")
23
24tokens = tokenizer(
25 prompt_template,
26 return_tensors='pt'
27).input_ids.cuda()
28
29# Generate output
30generation_output = model.generate(
31 tokens,
32 do_sample=True,
33 temperature=0.7,
34 top_p=0.95,
35 top_k=40,
36 max_new_tokens=512
37)
38
39print("Output: ", tokenizer.decode(generation_output[0]))
40
41# Inference can also be done using transformers' pipeline
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'])Stable Beluga 2 is a Llama2 70B model finetuned on an Orca style DatasetStable Beluga 2 using the following code snippet:1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3
4tokenizer = AutoTokenizer.from_pretrained("stabilityai/StableBeluga2", use_fast=False)
5model = AutoModelForCausalLM.from_pretrained("stabilityai/StableBeluga2", torch_dtype=torch.float16, low_cpu_mem_usage=True, device_map="auto")
6system_prompt = "### System:\nYou are Stable Beluga, an AI that follows instructions extremely well. Help as much as you can. Remember, be safe, and don't do anything illegal.\n\n"
7
8message = "Write me a poem please"
9prompt = f"{system_prompt}### User: {message}\n\n### Assistant:\n"
10inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
11output = model.generate(**inputs, do_sample=True, top_p=0.95, top_k=0, max_new_tokens=256)
12
13print(tokenizer.decode(output[0], skip_special_tokens=True))### System:
This is a system prompt, please behave and help the user.
### User:
Your prompt here
### Assistant:
The output of Stable Beluga 2Stable Beluga 2) is licensed under the STABLE BELUGA NON-COMMERCIAL COMMUNITY LICENSE AGREEMENTlm@stability.ai Stable Beluga 2 is trained on our internal Orca-style dataset| Dataset | Batch Size | Learning Rate | Learning Rate Decay | Warm-up | Weight Decay | Betas |
|---|---|---|---|---|---|---|
| Orca pt1 packed | 256 | 3e-5 | Cosine to 3e-6 | 100 | 1e-6 | (0.9, 0.95) |
| Orca pt2 unpacked | 512 | 3e-5 | Cosine to 3e-6 | 100 | 1e-6 | (0.9, 0.95) |
1@misc{StableBelugaModels,
2 url={[https://huggingface.co/stabilityai/StableBeluga2](https://huggingface.co/stabilityai/StableBeluga2)},
3 title={Stable Beluga models},
4 author={Mahan, Dakota and Carlow, Ryan and Castricato, Louis and Cooper, Nathan and Laforte, Christian}
5}1@misc{touvron2023llama,
2 title={Llama 2: Open Foundation and Fine-Tuned Chat Models},
3 author={Hugo Touvron and Louis Martin and Kevin Stone and Peter Albert and Amjad Almahairi and Yasmine Babaei and Nikolay Bashlykov and Soumya Batra and Prajjwal Bhargava and Shruti Bhosale and Dan Bikel and Lukas Blecher and Cristian Canton Ferrer and Moya Chen and Guillem Cucurull and David Esiobu and Jude Fernandes and Jeremy Fu and Wenyin Fu and Brian Fuller and Cynthia Gao and Vedanuj Goswami and Naman Goyal and Anthony Hartshorn and Saghar Hosseini and Rui Hou and Hakan Inan and Marcin Kardas and Viktor Kerkez and Madian Khabsa and Isabel Kloumann and Artem Korenev and Punit Singh Koura and Marie-Anne Lachaux and Thibaut Lavril and Jenya Lee and Diana Liskovich and Yinghai Lu and Yuning Mao and Xavier Martinet and Todor Mihaylov and Pushkar Mishra and Igor Molybog and Yixin Nie and Andrew Poulton and Jeremy Reizenstein and Rashi Rungta and Kalyan Saladi and Alan Schelten and Ruan Silva and Eric Michael Smith and Ranjan Subramanian and Xiaoqing Ellen Tan and Binh Tang and Ross Taylor and Adina Williams and Jian Xiang Kuan and Puxin Xu and Zheng Yan and Iliyan Zarov and Yuchen Zhang and Angela Fan and Melanie Kambadur and Sharan Narang and Aurelien Rodriguez and Robert Stojnic and Sergey Edunov and Thomas Scialom},
4 year={2023},
5 eprint={2307.09288},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}1@misc{mukherjee2023orca,
2 title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
3 author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
4 year={2023},
5 eprint={2306.02707},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}