Views
No views yet
1python examples/llama/convert_checkpoint.py \
2 --model_dir ./CodeLlama-13b-Instruct-hf \
3 --output_dir ./CodeLlama-13b-Instruct-hf_checkpoint \
4 --dtype float16 \
5 --quant_ckpt_path ./CodeLlama-13B-Instruct-GPTQ/model.safetensors \
6 --use_weight_only \
7 --weight_only_precision int4_gptq \
8 --per_group1trtllm-build \
2 --checkpoint_dir ./CodeLlama-13b-Instruct-hf_checkpoint \
3 --output_dir ./CodeLlama-13B-Instruct-GPTQ_TensorRT \
4 --gemm_plugin float16 \
5 --max_input_len 8192 \
6 --max_seq_len 8192[INST] <<SYS>>
Write code to solve the following coding problem that obeys the constraints and passes the example test cases. Please wrap your code answer using ```:
<</SYS>>
{prompt}
[/INST] pip3 install tensorrt_llm==0.15.0.dev2024101500 -U --pre --extra-index-url https://pypi.nvidia.com1from tensorrt_llm import LLM, SamplingParams
2
3system_prompt = \
4 "[INST] <<SYS>>\n" +\
5 "Write code to solve the following coding problem that obeys the constraints and passes the example test cases. Please wrap your code answer using ```:" +\
6 "\n<</SYS>>\n\n"
7
8user_prompt = \
9 "<Your user prompt>" +\
10 " [/INST] "
11
12prompts = [
13 system_prompt + user_prompt,
14]
15sampling_params = SamplingParams(max_tokens=512, temperature=1.31, top_p=0.14, top_k=49, repetition_penalty=1.17)
16
17llm = LLM(model="./CodeLlama-13B-Instruct-GPTQ_TensorRT")
18
19outputs = llm.generate(prompts, sampling_params)
20
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}")