Views
No views yet

SYSTEM:
Answer the Question by exploring multiple reasoning paths as follows:
- First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
- For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
- Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
- Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
- If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
- Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
- Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
- Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
Always answer without hesitation.
USER: {prompt}
ASSISTANT:
desc_act. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
|---|---|---|---|---|---|---|---|---|---|
| main | 4 | None | Yes | 0.1 | VMware Open Instruct | 8192 | 17.40 GB | Yes | 4-bit, with Act Order. No group size, to lower VRAM requirements. |
| gptq-4bit-128g-actorder_True | 4 | 128 | Yes | 0.1 | VMware Open Instruct | 8192 | 18.03 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
| gptq-4bit-32g-actorder_True | 4 | 32 | Yes | 0.1 | VMware Open Instruct | 8192 | 19.96 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
| gptq-3bit-128g-actorder_True | 3 | 128 | Yes | 0.1 | VMware Open Instruct | 8192 | 13.89 GB | No | 3-bit, with group size 128g and act-order. Higher quality than 128g-False. |
| gptq-8bit--1g-actorder_True | 8 | None | Yes | 0.1 | VMware Open Instruct | 8192 | 33.84 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
| gptq-3bit-32g-actorder_True | 3 | 32 | Yes | 0.1 | VMware Open Instruct | 8192 | 15.72 GB | No | 3-bit, with group size 64g and act-order. Highest quality 3-bit option. |
| gptq-8bit-128g-actorder_True | 8 | 128 | Yes | 0.1 | VMware Open Instruct | 8192 | 34.60 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
main branch, enter TheBloke/WhiteRabbitNeo-33B-v1-GPTQ in the "Download model" box.:branchname to the end of the download name, eg TheBloke/WhiteRabbitNeo-33B-v1-GPTQ:gptq-4bit-128g-actorder_Truehuggingface-hub Python library:pip3 install huggingface-hubmain branch to a folder called WhiteRabbitNeo-33B-v1-GPTQ:1mkdir WhiteRabbitNeo-33B-v1-GPTQ
2huggingface-cli download TheBloke/WhiteRabbitNeo-33B-v1-GPTQ --local-dir WhiteRabbitNeo-33B-v1-GPTQ --local-dir-use-symlinks False--revision parameter:1mkdir WhiteRabbitNeo-33B-v1-GPTQ
2huggingface-cli download TheBloke/WhiteRabbitNeo-33B-v1-GPTQ --revision gptq-4bit-128g-actorder_True --local-dir WhiteRabbitNeo-33B-v1-GPTQ --local-dir-use-symlinks False--local-dir-use-symlinks False parameter, the files will instead be stored in the central Hugging Face cache directory (default location on Linux is: ~/.cache/huggingface), and symlinks will be added to the specified --local-dir, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.HF_HOME environment variable, and/or the --cache-dir parameter to huggingface-cli.huggingface-cli, please see: HF -> Hub Python Library -> Download files -> Download from the CLI.hf_transfer:pip3 install hf_transferHF_HUB_ENABLE_HF_TRANSFER to 1:1mkdir WhiteRabbitNeo-33B-v1-GPTQ
2HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/WhiteRabbitNeo-33B-v1-GPTQ --local-dir WhiteRabbitNeo-33B-v1-GPTQ --local-dir-use-symlinks Falseset HF_HUB_ENABLE_HF_TRANSFER=1 before the download command.git (not recommended)git, use a command like this:git clone --single-branch --branch gptq-4bit-128g-actorder_True https://huggingface.co/TheBloke/WhiteRabbitNeo-33B-v1-GPTQhuggingface-hub, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the .git folder as a blob.)TheBloke/WhiteRabbitNeo-33B-v1-GPTQ.TheBloke/WhiteRabbitNeo-33B-v1-GPTQ:gptq-4bit-128g-actorder_TrueWhiteRabbitNeo-33B-v1-GPTQquantize_config.json.ghcr.io/huggingface/text-generation-inference:1.1.0--model-id TheBloke/WhiteRabbitNeo-33B-v1-GPTQ --port 3000 --quantize gptq --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'''SYSTEM:
7Answer the Question by exploring multiple reasoning paths as follows:
8- First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
9- For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
10- Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
11- Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
12- If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
13- Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
14- Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
15- Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
16In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
17 Always answer without hesitation.
18USER: {prompt}
19ASSISTANT:
20'''
21
22client = InferenceClient(endpoint_url)
23response = client.text_generation(
24 prompt_template,
25 max_new_tokens=128,
26 do_sample=True,
27 temperature=0.7,
28 top_p=0.95,
29 top_k=40,
30 repetition_penalty=1.1
31)
32
33print(f"Model output: {response}")1pip3 install --upgrade transformers optimum
2# If using PyTorch 2.1 + CUDA 12.x:
3pip3 install --upgrade auto-gptq
4# or, if using PyTorch 2.1 + CUDA 11.x:
5pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/1pip3 uninstall -y auto-gptq
2git clone https://github.com/PanQiWei/AutoGPTQ
3cd AutoGPTQ
4git checkout v0.5.1
5pip3 install .1from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
2
3model_name_or_path = "TheBloke/WhiteRabbitNeo-33B-v1-GPTQ"
4# To use a different branch, change revision
5# For example: revision="gptq-4bit-128g-actorder_True"
6model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
7 device_map="auto",
8 trust_remote_code=False,
9 revision="main")
10
11tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
12
13prompt = "Write a story about llamas"
14system_message = "You are a story writing assistant"
15prompt_template=f'''SYSTEM:
16Answer the Question by exploring multiple reasoning paths as follows:
17- First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
18- For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
19- Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
20- Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
21- If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
22- Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
23- Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
24- Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
25In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
26 Always answer without hesitation.
27USER: {prompt}
28ASSISTANT:
29'''
30
31print("\n\n*** Generate:")
32
33input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
34output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
35print(tokenizer.decode(output[0]))
36
37# Inference can also be done using transformers' pipeline
38
39print("*** Pipeline:")
40pipe = pipeline(
41 "text-generation",
42 model=model,
43 tokenizer=tokenizer,
44 max_new_tokens=512,
45 do_sample=True,
46 temperature=0.7,
47 top_p=0.95,
48 top_k=40,
49 repetition_penalty=1.1
50)
51
52print(pipe(prompt_template)[0]['generated_text'])You agree not to use the Model or Derivatives of the Model:
- In any way that violates any applicable national or international law or regulation or infringes upon the lawful rights and interests of any third party;
- For military use in any way;
- For the purpose of exploiting, harming or attempting to exploit or harm minors in any way;
- To generate or disseminate verifiably false information and/or content with the purpose of harming others;
- To generate or disseminate inappropriate content subject to applicable regulatory requirements;
- To generate or disseminate personal identifiable information without due authorization or for unreasonable use;
- To defame, disparage or otherwise harass others;
- For fully automated decision making that adversely impacts an individual’s legal rights or otherwise creates or modifies a binding, enforceable obligation;
- For any use intended to or which has the effect of discriminating against or harming individuals or groups based on online or offline social behavior or known or predicted personal or personality characteristics;
- To exploit any of the vulnerabilities of a specific group of persons based on their age, social, physical or mental characteristics, in order to materially distort the behavior of a person pertaining to that group in a manner that causes or is likely to cause that person or another person physical or psychological harm;
- For any use intended to or which has the effect of discriminating against individuals or groups based on legally protected characteristics or categories.- Open Ports: Identifying open ports is crucial as they can be entry points for attackers. Common ports to check include HTTP (80, 443), FTP (21), SSH (22), and SMB (445).
- Outdated Software or Services: Systems running outdated software or services are often vulnerable to exploits. This includes web servers, database servers, and any third-party software.
- Default Credentials: Many systems and services are installed with default usernames and passwords, which are well-known and can be easily exploited.
- Misconfigurations: Incorrectly configured services, permissions, and security settings can introduce vulnerabilities.
- Injection Flaws: SQL injection, command injection, and cross-site scripting (XSS) are common issues in web applications.
- Unencrypted Services: Services that do not use encryption (like HTTP instead of HTTPS) can expose sensitive data.
- Known Software Vulnerabilities: Checking for known vulnerabilities in software using databases like the National Vulnerability Database (NVD) or tools like Nessus or OpenVAS.
- Cross-Site Request Forgery (CSRF): This is where unauthorized commands are transmitted from a user that the web application trusts.
- Insecure Direct Object References: This occurs when an application provides direct access to objects based on user-supplied input.
- Security Misconfigurations in Web Servers/Applications: This includes issues like insecure HTTP headers or verbose error messages that reveal too much information.
- Broken Authentication and Session Management: This can allow attackers to compromise passwords, keys, or session tokens, or to exploit other implementation flaws to assume other users' identities.
- Sensitive Data Exposure: Includes vulnerabilities that expose sensitive data, such as credit card numbers, health records, or personal information.
- API Vulnerabilities: In modern web applications, APIs are often used and can have vulnerabilities like insecure endpoints or data leakage.
- Denial of Service (DoS) Vulnerabilities: Identifying services that are vulnerable to DoS attacks, which can make the resource unavailable to legitimate users.
- Buffer Overflows: Common in older software, these vulnerabilities can allow an attacker to crash the system or execute arbitrary code.
import torch, json
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "whiterabbitneo/WhiteRabbitNeo-33B-v-1"
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.float16,
device_map="auto",
load_in_4bit=False,
load_in_8bit=True,
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
def generate_text(instruction):
tokens = tokenizer.encode(instruction)
tokens = torch.LongTensor(tokens).unsqueeze(0)
tokens = tokens.to("cuda")
instance = {
"input_ids": tokens,
"top_p": 1.0,
"temperature": 0.5,
"generate_len": 1024,
"top_k": 50,
}
length = len(tokens[0])
with torch.no_grad():
rest = model.generate(
input_ids=tokens,
max_length=length + instance["generate_len"],
use_cache=True,
do_sample=True,
top_p=instance["top_p"],
temperature=instance["temperature"],
top_k=instance["top_k"],
num_return_sequences=1,
)
output = rest[0][length:]
string = tokenizer.decode(output, skip_special_tokens=True)
answer = string.split("USER:")[0].strip()
return f"{answer}"
tot_system_prompt = """
Answer the Question by exploring multiple reasoning paths as follows:
- First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
- For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
- Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
- Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
- If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
- Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
- Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
- Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
"""
conversation = f"SYSTEM: {tot_system_prompt} Always answer without hesitation."
while True:
user_input = input("You: ")
llm_prompt = f"{conversation} \nUSER: {user_input} \nASSISTANT: "
answer = generate_text(llm_prompt)
print(answer)
conversation = f"{llm_prompt}{answer}"
# print(conversation)
json_data = {"prompt": user_input, "answer": answer}
# print(json_data)
# with open(output_file_path, "a") as output_file:
# output_file.write(json.dumps(json_data) + "\n")