Views
No views yet
Yi-34B-200KYi-34B-200K.1from awq import AutoAWQForCausalLM
2from datasets import load_dataset
3from random import randint
4from transformers import AutoTokenizer
5
6dataset_size = 20_000
7model_path = '/PATH/TO/ORIGINAL/YI-34B-200K'
8quant_path = 'quant'
9quant_config = { "zero_point": True, "q_group_size": 128, "w_bit": 4, "version": "GEMM" }
10model = AutoAWQForCausalLM.from_pretrained(model_path, trust_remote_code=True)
11tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
12
13def load_orca():
14 data = load_dataset('Open-Orca/OpenOrca', split='train')
15 def concatenate_data(x):
16 s = str(x['system_prompt']).strip()
17 q = str(x['question']).strip().split('Answer:')[0].strip()
18 a = str(x['response']).strip()
19 return '{}\n\nHuman:\n{}\n\nAssistant:\n{}\n'.format(s, q, a)
20 concatenated = [concatenate_data(data[randint(0, len(data))]) for _ in range(dataset_size)]
21 return [text for text in concatenated]
22
23model.quantize(tokenizer, quant_config=quant_config, calib_data=load_orca())
24
25model.save_quantized(quant_path)
26tokenizer.save_pretrained(quant_path)1# ...
2template = f'{system_prompt}\n\nHuman:\n{user_prompt}\n\nAssistant:\n'
3# ...1User's request:
2Prove that there is a connection between nails and hunger.
3
4
5Model's response:
6Task Statement: Argumentatively prove or refute the following logical statement: "There is a connection between nails and hunger."
7
8Logical Reasoning Solution:
91. Analyze the Task Statement: The task statement asks to argueatively prove or refute the statement "There is a connection between nails and hunger."
102. Define the Terms: Nails refer to the keratin-based protective structures on the tips of fingers and toes. Hunger, on the other hand, is a physiological sensation of lacking food and a drive to consume it.
113. Analyze the Relationship: There is no direct physiological or biological connection between nails and hunger. Nails are not directly related to the sensation of hunger or the regulation of food intake.
124. Exploring Potential Connections: It is important to consider indirect or metaphorical connections. However, there is no established indirect connection between nails and hunger.
135. Analyze the Task: The task is to argueatively prove or refute the statement. Since there is no direct or indirect connection between nails and hunger, the statement is refutable.
14
15Therefore, the statement "There is a connection between nails and hunger" is refutable, as there is no direct or indirect relationship between nails and hunger.
16(-------------------------------------------------------------------------------------)
17(----> Generated in 684.5489482879639 seconds
18(-------------------------------------------------------------------------------------)