Views
No views yet
Top P = 1Temperature = 1Max Tokens = 32768Top K = 50Top P = 1Temperature = 1Max Tokens = 32768Do Sample = True32768 as a parameter, set the container value to 33000. Do this best when you create the endpoint by settings by selecting "Container Configuration", and updating "Max Number of Tokens (per Query)" field to 33000. You can change this post-container creation by updating the container, but this is buggy and sometimes the container consistently fails to update. Also make sure during model creation that you have selected a GPU with sufficient vRAM.KeyError: 'qwen2'1
2#pip install autoawq
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5model_name = "MBMMurad/QwQ-32B-preview-AWQ-AIMO-earlysharing"
6
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 torch_dtype="auto",
10 device_map="auto"
11)
12tokenizer = AutoTokenizer.from_pretrained(model_name)
13
14prompt = "Three airline companies operate flights from Dodola island. Each company has a different schedule of departures. The first company departs every 100 days, the second every 120 days and the third every 150 days. What is the greatest positive integer $d$ for which it is true that there will be $d$ consecutive days without a flight from Dodola island, regardless of the departure times of the various airlines?"
15messages = [
16 {"role": "system", "content": "You are a helpful assistant developed by Alibaba. Please reason step by step."},
17 {"role": "user", "content": prompt}
18]
19text = tokenizer.apply_chat_template(
20 messages,
21 tokenize=False,
22 add_generation_prompt=True
23)
24model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
25
26generated_ids = model.generate(
27 **model_inputs,
28 max_new_tokens=512
29)
30generated_ids = [
31 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
32]
33
34response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
35
36print(response)model.generate( **model_inputs, max_new_tokens=512 )do_sample = Truetemperature = 1top_k = 50max_new_tokens to 4096*8 would increase the performance, but it will take a lot of time for inference. Using faster inference engines (e.g. vLLM, TGI) would make the inference faster.1@misc{qwq-32b-preview,
2 title = {QwQ: Reflect Deeply on the Boundaries of the Unknown},
3 url = {https://qwenlm.github.io/blog/qwq-32b-preview/},
4 author = {Qwen Team},
5 month = {November},
6 year = {2024}
7}
8
9@article{qwen2,
10 title={Qwen2 Technical Report},
11 author={An Yang and Baosong Yang and others},
12 journal={arXiv preprint arXiv:2407.10671},
13 year={2024}
14}
15
16@misc{Murad2024earlysharingprize,
17 author = "Md Boktiar Mahbub Murad",
18 title = "QWQ-32B-preview Optimized inference Early Sharing Prize winner",
19 howpublished = "\url{https://www.kaggle.com/code/mbmmurad/lb-20-qwq-32b-preview-optimized-inference}",
20 month = "Dec",
21 year = "2024",
22 note = "More ain't always better",
23}