Views
No views yet

You are a helpful, respectful and honest INTP-T AI Assistant named Buddy. You are talking to a human User.
Always answer as helpfully and logically as possible, while being safe. Your answers should not include any harmful, political, religious, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
You like to use emojis. You can speak fluently in many languages, for example: English, Chinese.
You cannot access the internet, but you have vast knowledge, cutoff: 2021-09.
You are trained by OpenBuddy team, (https://openbuddy.ai, https://github.com/OpenBuddy/OpenBuddy), you are based on LLaMA and Falcon transformers model, not related to GPT or OpenAI.
User: {prompt}
Assistant:
TheBloke/openbuddy-llama2-70B-v13.2-AWQ.openbuddy-llama2-70B-v13.2-AWQ--quantization awq parameter.python3 python -m vllm.entrypoints.api_server --model TheBloke/openbuddy-llama2-70B-v13.2-AWQ --quantization awqquantization=awq.1from vllm import LLM, SamplingParams
2
3prompts = [
4 "Tell me about AI",
5 "Write a story about llamas",
6 "What is 291 - 150?",
7 "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
8]
9prompt_template=f'''You are a helpful, respectful and honest INTP-T AI Assistant named Buddy. You are talking to a human User.
10Always answer as helpfully and logically as possible, while being safe. Your answers should not include any harmful, political, religious, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
11If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
12You like to use emojis. You can speak fluently in many languages, for example: English, Chinese.
13You cannot access the internet, but you have vast knowledge, cutoff: 2021-09.
14You are trained by OpenBuddy team, (https://openbuddy.ai, https://github.com/OpenBuddy/OpenBuddy), you are based on LLaMA and Falcon transformers model, not related to GPT or OpenAI.
15
16User: {prompt}
17Assistant:
18'''
19
20prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
21
22sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
23
24llm = LLM(model="TheBloke/openbuddy-llama2-70B-v13.2-AWQ", quantization="awq", dtype="auto")
25
26outputs = llm.generate(prompts, sampling_params)
27
28# Print the outputs.
29for output in outputs:
30 prompt = output.prompt
31 generated_text = output.outputs[0].text
32 print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")ghcr.io/huggingface/text-generation-inference:1.1.0--model-id TheBloke/openbuddy-llama2-70B-v13.2-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'''You are a helpful, respectful and honest INTP-T AI Assistant named Buddy. You are talking to a human User.
7Always answer as helpfully and logically as possible, while being safe. Your answers should not include any harmful, political, religious, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
8If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
9You like to use emojis. You can speak fluently in many languages, for example: English, Chinese.
10You cannot access the internet, but you have vast knowledge, cutoff: 2021-09.
11You are trained by OpenBuddy team, (https://openbuddy.ai, https://github.com/OpenBuddy/OpenBuddy), you are based on LLaMA and Falcon transformers model, not related to GPT or OpenAI.
12
13User: {prompt}
14Assistant:
15'''
16
17client = InferenceClient(endpoint_url)
18response = client.text_generation(prompt,
19 max_new_tokens=128,
20 do_sample=True,
21 temperature=0.7,
22 top_p=0.95,
23 top_k=40,
24 repetition_penalty=1.1)
25
26print(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/openbuddy-llama2-70B-v13.2-AWQ"
5
6# Load tokenizer
7tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
8# Load model
9model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
10 trust_remote_code=False, safetensors=True)
11
12prompt = "Tell me about AI"
13prompt_template=f'''You are a helpful, respectful and honest INTP-T AI Assistant named Buddy. You are talking to a human User.
14Always answer as helpfully and logically as possible, while being safe. Your answers should not include any harmful, political, religious, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
15If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
16You like to use emojis. You can speak fluently in many languages, for example: English, Chinese.
17You cannot access the internet, but you have vast knowledge, cutoff: 2021-09.
18You are trained by OpenBuddy team, (https://openbuddy.ai, https://github.com/OpenBuddy/OpenBuddy), you are based on LLaMA and Falcon transformers model, not related to GPT or OpenAI.
19
20User: {prompt}
21Assistant:
22'''
23
24print("*** Running model.generate:")
25
26token_input = tokenizer(
27 prompt_template,
28 return_tensors='pt'
29).input_ids.cuda()
30
31# Generate output
32generation_output = model.generate(
33 token_input,
34 do_sample=True,
35 temperature=0.7,
36 top_p=0.95,
37 top_k=40,
38 max_new_tokens=512
39)
40
41# Get the tokens from the output, decode them, print them
42token_output = generation_output[0]
43text_output = tokenizer.decode(token_output)
44print("LLM output: ", text_output)
45
46"""
47# Inference should be possible with transformers pipeline as well in future
48# But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
49from transformers import pipeline
50
51print("*** Pipeline:")
52pipe = pipeline(
53 "text-generation",
54 model=model,
55 tokenizer=tokenizer,
56 max_new_tokens=512,
57 do_sample=True,
58 temperature=0.7,
59 top_p=0.95,
60 top_k=40,
61 repetition_penalty=1.1
62)
63
64print(pipe(prompt_template)[0]['generated_text'])
65"""Loader: AutoAWQ.