Views
No views yet
Znerual/TinyLlama-1.1B-intermediate-step-1431k-3T-AWQ.TinyLlama-1.1B-intermediate-step-1431k-3T-AWQ--quantization awq parameter.python3 -m vllm.entrypoints.api_server --model Znerual/TinyLlama-1.1B-intermediate-step-1431k-3T-AWQ --quantization awq --dtype autoquantization=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'''[INST] {prompt} [/INST]
10'''
11
12prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
13
14sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
15
16llm = LLM(model="Znerual/TinyLlama-1.1B-intermediate-step-1431k-3T-AWQ", quantization="awq", dtype="auto")
17
18outputs = llm.generate(prompts, sampling_params)
19
20# Print the outputs.
21for output in outputs:
22 prompt = output.prompt
23 generated_text = output.outputs[0].text
24 print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")ghcr.io/huggingface/text-generation-inference:1.1.0--model-id Znerual/TinyLlama-1.1B-intermediate-step-1431k-3T-AWQ --port 3000 --quantize awq --max-input-length 1902 --max-total-tokens 2048 --max-batch-prefill-tokens 2048pip3 install huggingface-hub1from huggingface_hub import InferenceClient
2
3endpoint_url = "https://your-endpoint-url-here"
4
5prompt = "Tell me about AI"
6prompt_template=f'''[INST] {prompt} [/INST]
7'''
8
9client = InferenceClient(endpoint_url)
10response = client.text_generation(prompt,
11 max_new_tokens=128,
12 do_sample=True,
13 temperature=0.7,
14 top_p=0.95,
15 top_k=40,
16 repetition_penalty=1.1)
17
18print(f"Model output: ", response)pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl1pip3 uninstall -y autoawq
2git clone https://github.com/casper-hansen/AutoAWQ
3cd AutoAWQ
4pip3 install .1from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
2
3model_name_or_path = "Znerual/TinyLlama-1.1B-intermediate-step-1431k-3T-AWQ"
4
5tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
6model = AutoModelForCausalLM.from_pretrained(
7 model_name_or_path,
8 low_cpu_mem_usage=True,
9 device_map="cuda:0"
10)
11
12# Using the text streamer to stream output one token at a time
13streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
14
15prompt = "Tell me about AI"
16prompt_template=f'''[INST] {prompt} [/INST]
17'''
18
19# Convert prompt to tokens
20tokens = tokenizer(
21 prompt_template,
22 return_tensors='pt'
23).input_ids.cuda()
24
25generation_params = {
26 "do_sample": True,
27 "temperature": 0.7,
28 "top_p": 0.95,
29 "top_k": 40,
30 "max_new_tokens": 512,
31 "repetition_penalty": 1.1
32}
33
34# Generate streamed output, visible one token at a time
35generation_output = model.generate(
36 tokens,
37 streamer=streamer,
38 **generation_params
39)
40
41# Generation without a streamer, which will include the prompt in the output
42generation_output = model.generate(
43 tokens,
44 **generation_params
45)
46
47# Get the tokens from the output, decode them, print them
48token_output = generation_output[0]
49text_output = tokenizer.decode(token_output)
50print("model.generate output: ", text_output)
51
52# Inference is also possible via Transformers' pipeline
53from transformers import pipeline
54
55pipe = pipeline(
56 "text-generation",
57 model=model,
58 tokenizer=tokenizer,
59 **generation_params
60)
61
62pipe_output = pipe(prompt_template)[0]['generated_text']
63print("pipeline output: ", pipe_output)
64Loader: AutoAWQ.
| Model | Pretrain Tokens | HellaSwag | Obqa | WinoGrande | ARC_c | ARC_e | boolq | piqa | avg |
|---|---|---|---|---|---|---|---|---|---|
| Pythia-1.0B | 300B | 47.16 | 31.40 | 53.43 | 27.05 | 48.99 | 60.83 | 69.21 | 48.30 |
| TinyLlama-1.1B-intermediate-step-50K-104b | 103B | 43.50 | 29.80 | 53.28 | 24.32 | 44.91 | 59.66 | 67.30 | 46.11 |
| TinyLlama-1.1B-intermediate-step-240k-503b | 503B | 49.56 | 31.40 | 55.80 | 26.54 | 48.32 | 56.91 | 69.42 | 48.28 |
| TinyLlama-1.1B-intermediate-step-480k-1007B | 1007B | 52.54 | 33.40 | 55.96 | 27.82 | 52.36 | 59.54 | 69.91 | 50.22 |
| TinyLlama-1.1B-intermediate-step-715k-1.5T | 1.5T | 53.68 | 35.20 | 58.33 | 29.18 | 51.89 | 59.08 | 71.65 | 51.29 |
| TinyLlama-1.1B-intermediate-step-955k-2T | 2T | 54.63 | 33.40 | 56.83 | 28.07 | 54.67 | 63.21 | 70.67 | 51.64 |
| TinyLlama-1.1B-intermediate-step-1195k-2.5T | 2.5T | 58.96 | 34.40 | 58.72 | 31.91 | 56.78 | 63.21 | 73.07 | 53.86 |
| TinyLlama-1.1B-intermediate-step-1431k-3T | 3T | 59.20 | 36.00 | 59.12 | 30.12 | 55.25 | 57.83 | 73.29 | 52.99 |