Views
No views yet
Floppanacci/DeepSeek-R1-Distill-Qwen-7B-Floppanacci model.Floppanacci/QWQ-LongCOT-AIMO dataset.transformers (and autoawq)autoawq library:pip install autoawq transformers torchtransformers:1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "Floppanacci/DeepSeek-R1-Distill-Qwen-7B-Floppanacci-AWQ"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6# Load the AWQ quantized model
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 device_map="auto" # Automatically uses available GPU(s)
10)
11
12# Example Prompt (adjust based on how the model expects input)
13prompt = "Question: Let $ABCD$ be a unit square. Let $P$ be a point inside the square such that $PA = \sqrt{5}/3$, $PB = \sqrt{2}/3$, and $PC = \sqrt{5}/3$. Find the distance $PD$. Answer:"
14inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
15
16# Generate
17outputs = model.generate(**inputs, max_new_tokens=300, temperature=0.1, do_sample=False) # Example settings
18response = tokenizer.decode(outputs[0], skip_special_tokens=True)
19
20print(response)
21vLLM (Optimized Inference)pip install vllm1from vllm import LLM, SamplingParams
2
3# Define prompts
4prompts = [
5 "Question: Let $ABCD$ be a unit square. Let $P$ be a point inside the square such that $PA = \sqrt{5}/3$, $PB = \sqrt{2}/3$, and $PC = \sqrt{5}/3$. Find the distance $PD$. Answer:",
6 "Question: What is the sum of the first 100 positive integers? Answer:",
7]
8
9# Define sampling parameters
10sampling_params = SamplingParams(temperature=0.1, top_p=0.95, max_tokens=300)
11
12# Initialize the LLM engine with the AWQ model
13llm = LLM(model="Floppanacci/DeepSeek-R1-Distill-Qwen-7B-Floppanacci-AWQ",
14 quantization="awq",
15 dtype="auto", # vLLM will typically use half-precision for activations (use bfloat16 on compatible hardware e.g. L4, A100, H100, etc.)
16 trust_remote_code=True
17 )
18
19# Generate responses
20outputs = llm.generate(prompts, sampling_params)
21
22# Print the outputs
23for output in outputs:
24 prompt = output.prompt
25 generated_text = output.outputs[0].text
26 print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
27