File size: 3,766 Bytes
6b84f2b ad35440 6b84f2b ad51ab6 6b84f2b 82c7d95 6b84f2b d0fdd1a 6b84f2b ad51ab6 a84b8ed ad51ab6 a84b8ed ad51ab6 |
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 |
---
title: StarCoder2
emoji: ✨2️⃣✨
colorFrom: yellow
colorTo: blue
sdk: gradio
sdk_version: 5.12.0
app_file: app.py
pinned: true
license: mit
short_description: Latest Coding Model By🤗Huggingface & Friends-101 languages!
---
StarCoder2
🌟 Latest Coding Model By 🤗 Huggingface & Friends - Supports 101 Programming Languages! 🌟
StarCoder2 is an advanced coding model designed to support a wide range of programming tasks, from code generation to bug fixing, across 101 programming languages. With state-of-the-art performance and seamless integration, StarCoder2 is your go-to tool for coding excellence.
📜 License
StarCoder2 is distributed under the Apache 2.0 License.
🏅 Model Badges
Languages Supported: 101
Framework Compatibility: Hugging Face Transformers
Model Size: 15B Parameters
🌐 Model Capabilities
🗣 Languages Supported
StarCoder2 supports 101 programming languages, including but not limited to:
Python, JavaScript, Java, C++, Go, Rust, HTML, CSS, SQL, TypeScript, and more.
🚀 Performance
StarCoder2 achieves high accuracy and performance on multiple coding benchmarks, making it a reliable choice for complex programming tasks.
🔧 Tasks
StarCoder2 excels at:
Code Generation: Create boilerplate code or complete functions.
Code Completion: Predict the next lines of code with context.
Bug Fixing: Identify and resolve errors in your code.
📥 Installation and Usage
🛠 Installation
Ensure you have the Hugging Face Transformers library installed. You can do so by running:
pip install git+https://github.com/huggingface/transformers.git
Alternatively, use the provided requirements.txt file:
pip install -r requirements.txt
💻 Usage Examples
Here’s how you can load the StarCoder2 model and generate code:
Python Code Example:
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the model and tokenizer
model_name = "bigcode/starcoder2-15b"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
# Input prompt
prompt = "def fibonacci(n):"
inputs = tokenizer(prompt, return_tensors="pt")
# Generate code
outputs = model.generate(inputs["input_ids"], max_new_tokens=50)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
JavaScript Code Example:
const { AutoModelForCausalLM, AutoTokenizer } = require('@huggingface/transformers');
async function generateCode() {
const modelName = 'bigcode/starcoder2-15b';
const tokenizer = await AutoTokenizer.from_pretrained(modelName);
const model = await AutoModelForCausalLM.from_pretrained(modelName);
const prompt = 'function calculateFactorial(num) {';
const inputs = tokenizer.encode(prompt, { return_tensors: 'pt' });
const output = await model.generate(inputs, { max_new_tokens: 50 });
console.log(tokenizer.decode(output[0]));
}
generateCode();
📚 Additional Resources
Hugging Face Model Hub
Explore StarCoder2 on Hugging Face: StarCoder2-15B Model Card
Configuration Reference
Detailed configuration options are available in the documentation.
📖 Citation
If you use StarCoder2 in your research or projects, please cite the following:
@misc{starcoder2,
author = {Huggingface and Friends},
title = {StarCoder2: A State-of-the-Art Coding Model},
year = {2025},
url = {https://huggingface.co/bigcode/starcoder2-15b/blob/main/README.md}
}
🤝 Community and Support
We welcome contributions and feedback from the community! Here’s how you can get involved:
Report Issues: Submit issues on GitHub.
Contribute: Fork the repository and make pull requests to improve StarCoder2.
Join Discussions: Participate in discussions on Hugging Face Forums.
Thank you for using StarCoder2! 🚀 |