infly/OpenCoder-1.5B-Base
25462
1---2license: other3license_name: inf4license_link: https://huggingface.co/infly/OpenCoder-1.5B-Base/blob/main/LICENSE5language:6- en7- zh8pipeline_tag: text-generation9library_name: transformers10---11 12 13 14<div align="center">15 <img src="https://github.com/OpenCoder-llm/opencoder-llm.github.io/blob/main/static/images/opencoder_icon.jpg?raw=true" width="50%" alt="OpenCoder-Icon" />16</div>17 18 19 20<p align="center">21 <!-- <a href="https://arxiv.org/pdf/2411.04905"><b>Paper Link</b>ποΈ</a> -->22 π <a href="https://opencoder-llm.github.io/">Home Page</a>   | 23    π€ <a href="https://huggingface.co/collections/infly/opencoder-672cec44bbb86c39910fb55e">Model</a>   | 24    π <a href="https://huggingface.co/collections/OpenCoder-LLM/opencoder-datasets-672e6db6a0fed24bd69ef1c2">Dataset</a>   | 25    π<a href="https://arxiv.org/abs/2411.04905">Paper</a>  26</p>27 28 29## 1. Introduction30 31**OpenCoder** is an open and reproducible code LLM family which includes 1.5B and 8B base and chat models, supporting both English and Chinese languages. Starting from scratch, OpenCoder is pretrained on 2.5 trillion tokens composed of 90% raw code and 10% code-related web data, and supervised finetuned on over 4.5M high-quality SFT examples, finally reaching the performance of top-tier code LLMs. We provide not only model weights and inference code, but also the reproducible training data, the complete data processing pipeline, rigorous experimental ablation results, and detailed training protocols. Empowering researchers to build and innovate, OpenCoder is your open foundation for advancing code AI. 32 33- **Complete Open Source**: OpenCoder ensures full transparency by releasing not only the model weights and forthcoming inference code but also the complete data-cleaning code for training. This release includes high-quality synthetic data, an extensive set of checkpoints, and a dataset of over 4.5 million supervised fine-tuning (SFT) entries, making OpenCoder one of the most comprehensively open-sourced models available.34- **Comprehensive Experimental Analysis**: OpenCoder is rigorously tested through extensive ablation studies on various data-cleaning strategies and training processes, including file-level and repository-level deduplication experiments, ensuring thorough exploration and validation of the modelβs performance.35- **High-Quality Synthetic Data**: OpenCoder provides a fully developed synthetic data generation process and over 4.5 million SFT data entries, establishing a robust data foundation for model training and evaluation.36- **Exceptional Performance**: OpenCoder achieves high performance across multiple language model benchmarks, positioning it among the leading open-source models for code.37 38 39## 2. Models40 41| Model | Sequence Length | Download |42|:---------------------:|:---------------:|:-----------------------------------------------------------------------:|43| OpenCoder-1.5B-Base | 4K | π€ [HuggingFace](https://huggingface.co/infly/OpenCoder-1.5B-Base) |44| OpenCoder-8B-Base | 8K | π€ [HuggingFace](https://huggingface.co/infly/OpenCoder-8B-Base) |45| OpenCoder-1.5B-Instruct | 4K | π€ [HuggingFace](https://huggingface.co/infly/OpenCoder-1.5B-Instruct) |46| OpenCoder-8B-Instruct | 8K | π€ [HuggingFace](https://huggingface.co/infly/OpenCoder-8B-Instruct) |47 48 49## 3. Datasets50 51### Pre-training52 53| Dataset | Size | Download |54|:---------------------:|:---------------:|:-----------------------------------------------------------------------:|55| fineweb-code-corpus | 148 GB | π€ [HuggingFace](https://huggingface.co/datasets/OpenCoder-LLM/fineweb-code-corpus) |56| fineweb-math-corpus | 10 GB | π€ [HuggingFace](https://huggingface.co/datasets/OpenCoder-LLM/fineweb-math-corpus) |57 58 59**This is not the end; we are organizing the remaining data and uploading it progressively.**60 61## 4. Benchmarks62 63**Note:** For the detailed evaluation results, please refer to [our paper](https://arxiv.org/pdf/2411.04905).64 65<!-- ### Base Model -->66| model | OpenCoder-1.5B-Base | OpenCoder-8B-Base |67|:---------------:|:-------------:|:------------:|68| HumanEval(+) | 54.3 (49.4) | 66.5 (63.4) |69| MBPP(+) | 70.6 (58.7) | 79.9 (70.4) |70| BigCodeBench | 24.5 | 40.5 |71| BigCodeBench-Hard | 5.4 | 9.5 |72 73 74<!-- ### Chat Model75| model | OpenCoder-1.5B-Instruct | OpenCoder-8B-Instruct |76|:---------------:|:-------------:|:------------:|77| HumanEval(+) | 72.5 (67.7) | 83.5 (78.7) |78| MBPP(+) | 72.7 (61.9) | 79.1 (69.0) |79| BigCodeBench | 33.3 | 40.3 |80| BigCodeBench-Hard | 11.5 | 16.9 |81| LiveCodeBench | 12.8 | 23.2 |82| MultiPL-E (AVG) | 57.5 | 71.0 | -->83 84 85## 5. Inference86 87### Inference with Huggingface's Transformers88 89```python90import torch91from transformers import AutoTokenizer, AutoModelForCausalLM92 93model_name = "infly/OpenCoder-1.5B-Base"94model = AutoModelForCausalLM.from_pretrained(model_name,95 torch_dtype=torch.bfloat16,96 device_map="auto",97 trust_remote_code=True)98tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)99 100 101inputs = tokenizer("# write a quick sort algorithm", return_tensors="pt")102outputs = model.generate(**inputs.to(model.device), max_new_tokens=128)103 104result = tokenizer.decode(outputs[0], skip_special_tokens=True)105print(result)106```107 108<!-- ### Inference with vLLM (recommended) -->109 110## 6. License111 112OpenCoder series (including Base and Chat) support commercial applications under a permissive [License](https://huggingface.co/infly/OpenCoder-1.5B-Base/blob/main/LICENSE).113 114## 7. Citation115```116@inproceedings{Huang2024OpenCoderTO,117 title={OpenCoder: The Open Cookbook for Top-Tier Code Large Language Models},118 author={Siming Huang and Tianhao Cheng and Jason Klein Liu and Jiaran Hao and Liuyihan Song and Yang Xu and J. Yang and J. H. Liu and Chenchen Zhang and Linzheng Chai and Ruifeng Yuan and Zhaoxiang Zhang and Jie Fu and Qian Liu and Ge Zhang and Zili Wang and Yuan Qi and Yinghui Xu and Wei Chu},119 year={2024},120 url={https://arxiv.org/pdf/2411.04905}121}122```