Deploy Seed-Coder-8B-Instruct with vLLM
masterFor high-throughput inference, Seed-Coder-8B-Instruct is fully supported by vLLM. You can perform offline batched inference by initializing the LLM class and defining SamplingParams for decoding hyperparameters like temperature, top_p, and max_tokens.
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
# Initialize the tokenizer
tokenizer = AutoTokenizer.from_pretrained("ByteDance-Seed/Seed-Coder-8B-Instruct")
# Pass the default decoding hyperparameters of Seed-Coder-8B-Instruct
# max_tokens is for the maximum length for generation.
sampling_params = SamplingParams(temperature=0.6, top_p=0.8, repetition_penalty=1.05, max_tokens=512)
# Input the model name or path. Can be GPTQ or AWQ models.
llm = LLM(model="ByteDance-Seed/Seed-Coder-8B-Instruct")
# Prepare your prompts
prompt = "#write a quick sort algorithm."
# generate outputs
outputs = llm.generate([prompt], sampling_params)
# Print the outputs.
for output in outputs:
prompt = output.prompt
generated_text = output.outputs[0].text
print(f"Prompt: {prompt!r}\n\nGenerated content: {generated_text!r}")