Text Generation
Transformers
Safetensors
English
Chinese
llama
conversational
text-generation-inference
Instructions to use infly/OpenCoder-8B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use infly/OpenCoder-8B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="infly/OpenCoder-8B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("infly/OpenCoder-8B-Instruct") model = AutoModelForCausalLM.from_pretrained("infly/OpenCoder-8B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use infly/OpenCoder-8B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "infly/OpenCoder-8B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "infly/OpenCoder-8B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/infly/OpenCoder-8B-Instruct
- SGLang
How to use infly/OpenCoder-8B-Instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "infly/OpenCoder-8B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "infly/OpenCoder-8B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "infly/OpenCoder-8B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "infly/OpenCoder-8B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use infly/OpenCoder-8B-Instruct with Docker Model Runner:
docker model run hf.co/infly/OpenCoder-8B-Instruct
File size: 8,691 Bytes
1d83742 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | {
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:674452ba-d230-4d3b-90b5-74ccd0c20c63",
"version": 1,
"metadata": {
"timestamp": "2025-06-05T09:40:49.133901+00:00",
"component": {
"type": "machine-learning-model",
"bom-ref": "infly/OpenCoder-8B-Instruct-d195bd27-df6f-5de8-8ab3-9f475c6cc49c",
"name": "infly/OpenCoder-8B-Instruct",
"externalReferences": [
{
"url": "https://huggingface.co/infly/OpenCoder-8B-Instruct",
"type": "documentation"
}
],
"modelCard": {
"modelParameters": {
"task": "text-generation",
"architectureFamily": "llama",
"modelArchitecture": "LlamaForCausalLM",
"datasets": [
{
"ref": "OpenCoder-LLM/opencoder-sft-stage1-372d7af3-6153-5091-b5cd-39c612c74e03"
},
{
"ref": "OpenCoder-LLM/opencoder-sft-stage2-ea53b7ac-b98d-5eef-a195-834ce3ec5a49"
}
]
},
"properties": [
{
"name": "library_name",
"value": "transformers"
},
{
"name": "base_model",
"value": "infly/OpenCoder-8B-Base"
}
]
},
"authors": [
{
"name": "infly"
}
],
"licenses": [
{
"license": {
"name": "inf",
"url": "https://huggingface.co/infly/OpenCoder-8B-Instruct/blob/main/LICENSE"
}
}
],
"tags": [
"transformers",
"safetensors",
"llama",
"text-generation",
"conversational",
"en",
"zh",
"dataset:OpenCoder-LLM/opencoder-sft-stage1",
"dataset:OpenCoder-LLM/opencoder-sft-stage2",
"arxiv:2411.04905",
"base_model:infly/OpenCoder-8B-Base",
"base_model:finetune:infly/OpenCoder-8B-Base",
"license:other",
"autotrain_compatible",
"text-generation-inference",
"endpoints_compatible",
"region:us"
]
}
},
"components": [
{
"type": "data",
"bom-ref": "OpenCoder-LLM/opencoder-sft-stage1-372d7af3-6153-5091-b5cd-39c612c74e03",
"name": "OpenCoder-LLM/opencoder-sft-stage1",
"data": [
{
"type": "dataset",
"bom-ref": "OpenCoder-LLM/opencoder-sft-stage1-372d7af3-6153-5091-b5cd-39c612c74e03",
"name": "OpenCoder-LLM/opencoder-sft-stage1",
"contents": {
"url": "https://huggingface.co/datasets/OpenCoder-LLM/opencoder-sft-stage1",
"properties": [
{
"name": "configs",
"value": "Name of the dataset subset: filtered_infinity_instruct {\"split\": \"train\", \"path\": \"data/filtered_infinity_instruct-*\"}"
},
{
"name": "configs",
"value": "Name of the dataset subset: largescale_diverse_instruct {\"split\": \"train\", \"path\": \"data/largescale_diverse_instruct-*\"}"
},
{
"name": "configs",
"value": "Name of the dataset subset: realuser_instruct {\"split\": \"train\", \"path\": \"data/realuser_instruct-*\"}"
},
{
"name": "license",
"value": "mit"
}
]
},
"governance": {
"owners": [
{
"organization": {
"name": "OpenCoder-LLM",
"url": "https://huggingface.co/OpenCoder-LLM"
}
}
]
},
"description": "\n\n\t\n\t\t\n\t\tOpenCoder Dataset\n\t\n\nThe OpenCoder dataset is composed of the following datasets:\n\nopc-sft-stage1: the sft data used for opencoder sft-stage1 <-- you are here\nopc-sft-stage2: the sft data used for opencoder sft-stage2\nopc-annealing-corpus: the synthetic data & algorithmic corpus used for opencoder annealing\nopc-fineweb-code-corpus: the code-related page recalled from fineweb\nopc-fineweb-math-corpus: the math-related page recalled from finewebrefineCode-code-corpus-meta: the meta-data\u2026 See the full description on the dataset page: https://huggingface.co/datasets/OpenCoder-LLM/opc-sft-stage1."
}
]
},
{
"type": "data",
"bom-ref": "OpenCoder-LLM/opencoder-sft-stage2-ea53b7ac-b98d-5eef-a195-834ce3ec5a49",
"name": "OpenCoder-LLM/opencoder-sft-stage2",
"data": [
{
"type": "dataset",
"bom-ref": "OpenCoder-LLM/opencoder-sft-stage2-ea53b7ac-b98d-5eef-a195-834ce3ec5a49",
"name": "OpenCoder-LLM/opencoder-sft-stage2",
"contents": {
"url": "https://huggingface.co/datasets/OpenCoder-LLM/opencoder-sft-stage2",
"properties": [
{
"name": "configs",
"value": "Name of the dataset subset: educational_instruct {\"split\": \"train\", \"path\": \"educational_instruct/train-*\"}"
},
{
"name": "configs",
"value": "Name of the dataset subset: evol_instruct {\"split\": \"train\", \"path\": \"evol_instruct/train-*\"}"
},
{
"name": "configs",
"value": "Name of the dataset subset: mceval_instruct {\"split\": \"train\", \"path\": \"mceval_instruct/train-*\"}"
},
{
"name": "configs",
"value": "Name of the dataset subset: package_instruct {\"split\": \"train\", \"path\": \"package_instruct/train-*\"}"
},
{
"name": "license",
"value": "mit"
}
]
},
"governance": {
"owners": [
{
"organization": {
"name": "OpenCoder-LLM",
"url": "https://huggingface.co/OpenCoder-LLM"
}
}
]
},
"description": "\n\n\t\n\t\t\n\t\tOpenCoder Dataset\n\t\n\nThe OpenCoder dataset is composed of the following datasets:\n\nopc-sft-stage1: the sft data used for opencoder sft-stage1\nopc-sft-stage2: the sft data used for opencoder sft-stage2 <-- you are here\nopc-annealing-corpus: the synthetic data & algorithmic corpus used for opencoder annealing\nopc-fineweb-code-corpus: the code-related page recalled from fineweb\nopc-fineweb-math-corpus: the math-related page recalled from finewebrefineCode-code-corpus-meta: the meta-data\u2026 See the full description on the dataset page: https://huggingface.co/datasets/OpenCoder-LLM/opc-sft-stage2."
}
]
}
]
} |