Text Generation
Transformers
PyTorch
Safetensors
English
Chinese
llama
conversational
text-generation-inference
Instructions to use infly/OpenCoder-8B-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use infly/OpenCoder-8B-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="infly/OpenCoder-8B-Base") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("infly/OpenCoder-8B-Base") model = AutoModelForMultimodalLM.from_pretrained("infly/OpenCoder-8B-Base") 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 Settings
- vLLM
How to use infly/OpenCoder-8B-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "infly/OpenCoder-8B-Base" # 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-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/infly/OpenCoder-8B-Base
- SGLang
How to use infly/OpenCoder-8B-Base 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-Base" \ --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-Base", "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-Base" \ --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-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use infly/OpenCoder-8B-Base with Docker Model Runner:
docker model run hf.co/infly/OpenCoder-8B-Base
Update README.md
Browse files
README.md
CHANGED
|
@@ -41,7 +41,21 @@ library_name: transformers
|
|
| 41 |
| OpenCoder-1.5B-Instruct | 4K | 🤗 [HuggingFace](https://huggingface.co/infly/OpenCoder-1.5B-Instruct) |
|
| 42 |
| OpenCoder-8B-Instruct | 8K | 🤗 [HuggingFace](https://huggingface.co/infly/OpenCoder-8B-Instruct) |
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
**Note:** For the detailed evaluation results, please refer to [our paper](https://arxiv.org/pdf/2411.04905).
|
| 47 |
|
|
@@ -65,7 +79,7 @@ library_name: transformers
|
|
| 65 |
| MultiPL-E (AVG) | 57.5 | 71.0 | -->
|
| 66 |
|
| 67 |
|
| 68 |
-
##
|
| 69 |
|
| 70 |
### Inference with Huggingface's Transformers
|
| 71 |
|
|
@@ -90,11 +104,11 @@ print(result)
|
|
| 90 |
|
| 91 |
<!-- ### Inference with vLLM (recommended) -->
|
| 92 |
|
| 93 |
-
##
|
| 94 |
|
| 95 |
OpenCoder series (including Base and Chat) support commercial applications under a permissive [License](https://huggingface.co/infly/OpenCoder-8B-Base/blob/main/LICENSE).
|
| 96 |
|
| 97 |
-
##
|
| 98 |
```
|
| 99 |
@inproceedings{Huang2024OpenCoderTO,
|
| 100 |
title={OpenCoder: The Open Cookbook for Top-Tier Code Large Language Models},
|
|
|
|
| 41 |
| OpenCoder-1.5B-Instruct | 4K | 🤗 [HuggingFace](https://huggingface.co/infly/OpenCoder-1.5B-Instruct) |
|
| 42 |
| OpenCoder-8B-Instruct | 8K | 🤗 [HuggingFace](https://huggingface.co/infly/OpenCoder-8B-Instruct) |
|
| 43 |
|
| 44 |
+
|
| 45 |
+
## 3. Datasets
|
| 46 |
+
|
| 47 |
+
### Pre-training
|
| 48 |
+
|
| 49 |
+
| Dataset | Size | Download |
|
| 50 |
+
|:---------------------:|:---------------:|:-----------------------------------------------------------------------:|
|
| 51 |
+
| fineweb-code-corpus | 148 GB | 🤗 [HuggingFace](https://huggingface.co/datasets/OpenCoder-LLM/fineweb-code-corpus) |
|
| 52 |
+
| fineweb-math-corpus | 10 GB | 🤗 [HuggingFace](https://huggingface.co/datasets/OpenCoder-LLM/fineweb-math-corpus) |
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
**This is not the end; we are organizing the remaining data and uploading it progressively.**
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
## 4. Benchmarks
|
| 59 |
|
| 60 |
**Note:** For the detailed evaluation results, please refer to [our paper](https://arxiv.org/pdf/2411.04905).
|
| 61 |
|
|
|
|
| 79 |
| MultiPL-E (AVG) | 57.5 | 71.0 | -->
|
| 80 |
|
| 81 |
|
| 82 |
+
## 5. Inference
|
| 83 |
|
| 84 |
### Inference with Huggingface's Transformers
|
| 85 |
|
|
|
|
| 104 |
|
| 105 |
<!-- ### Inference with vLLM (recommended) -->
|
| 106 |
|
| 107 |
+
## 6. License
|
| 108 |
|
| 109 |
OpenCoder series (including Base and Chat) support commercial applications under a permissive [License](https://huggingface.co/infly/OpenCoder-8B-Base/blob/main/LICENSE).
|
| 110 |
|
| 111 |
+
## 7. Citation
|
| 112 |
```
|
| 113 |
@inproceedings{Huang2024OpenCoderTO,
|
| 114 |
title={OpenCoder: The Open Cookbook for Top-Tier Code Large Language Models},
|