Downloads · 30 days
29
25% of all-time downloads
opencsg/opencsg-stable-code-3b-v1
opencsg-stable-code-3b-v1 is a text generation model from opencsg. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as llama2.
Downloads · 30 days
29
25% of all-time downloads
All-time downloads
118
Public
Parameters
2.8B
5.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors5.6 GB · 100%
From the Hugging Face model README
<a id="english"></a>
<p align="center"> <img width="300px" alt="OpenCSG" src="https://cdn-uploads.huggingface.co/production/uploads/64c71b27d43e4dee51a8b31a/GwYXPKuEoGCGcMICeW-sb.jpeg"> </p> <p align="center"><a href="https://portal.opencsg.com/models">[OpenCSG Community]</a> <a href="https://github.com/opencsgs">[github]</a> <a href="https://cdn-uploads.huggingface.co/production/uploads/64c71b27d43e4dee51a8b31a/HU6vz21qKTEmUBCWqCFh9.jpeg">[wechat]</a> <a href="https://twitter.com/OpenCsg">[Twitter]</a> </p> </div> OpenCSG stands for Converged resources, Software refinement, and Generative LM. The 'C' represents Converged resources, indicating the integration and full utilization of hybrid resources. The 'S' stands for Software refinement, signifying software that is refined by large models. The 'G' represents Generative LM, which denotes widespread, inclusive, and democratized generative large models.The vision of OpenCSG is to empower every industry, every company, and every individual to own their models. We adhere to the principles of openness and open source, making the large model software stack of OpenCSG available to the community. We welcome everyone to use, send feedback, and contribute collaboratively.
stable-code-3b is a decoder-only language model with 2.7 billion parameters, pre-trained on 1.3 trillion tokens of diverse textual and code datasets. The model is trained on 18 programming languages, selected based on the 2023 StackOverflow Developer Survey. It demonstrates state-of-the-art performance, compared to models of similar size, across multiple programming languages tested using BigCode's Evaluation Harness.
opencsg-stable-code-3b-v1 is a model based on stable-code-3b that have been fine-tuned using full-parameter tuning methods. <br>
This is the repository for the base 3B version finetuned based on stable-code-3b.
| Model Size | Base Model |
|---|---|
| 3B | opencsg/Opencsg-stable-coder-3b-v1 |
| opencsg-phi-2-v0.1 | opencsg/Opencsg-phi-2-v0.1 |
HumanEval is the most common code generation benchmark for evaluating model performance, especially on the compeltion of code exercise cases. Model evaluation is, to some extent, a metaphysics. Different models have different sensitivities to decoding methods, parameters and instructions. It is impratical for us to manually set specific configurations for each fine-tuned model, because a real LLM should master general capabilities despite the parameters being manipulated by users.
Therefore, OpenCSG racked their brains to provide a relatively fair method to compare the fine-tuned models on the HumanEval benchmark. To simplify the comparison, we chosed the Pass@1 metric for the Python language, but our fine-tuning dataset includes samples in multiple languages.
For fairness, we evaluated the original and fine-tuned stable-code-3b models based only on the prompts from the original cases, without including any other instructions.
Besides, we use the greedy decoding method for each model during evaluation.
| Model | HumanEval python pass@1 |
|---|---|
| stable-coder-3b | 29.3% |
| opencsg-stable-coder-3b-v1 | 46.3% |
| phi-2 | 48.2% |
| opencsg-phi-2-v0.1 | 54.3% |
TODO
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("opencsg/opencsg-stable-coder-3b-v1")
model = AutoModelForCausalLM.from_pretrained(
"opencsg/opencsg-stable-coder-3b-v1",
torch_dtype="auto",
)
model.cuda()
inputs = tokenizer("import torch\nimport torch.nn as nn", return_tensors="pt").to(model.device)
tokens = model.generate(
**inputs,
max_new_tokens=48,
temperature=0.2,
do_sample=True,
)
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
<a id="chinese"></a>
<p> </p>OpenCSG的愿景是让每个行业、每个公司、每个人都拥有自己的模型。 我们坚持开源开放的原则,将OpenCSG的大模型软件栈开源到社区,欢迎使用、反馈和参与共建,欢迎关注。
stable-code-3b是一个拥有27亿参数的解码器语言模型,使用了13000亿个多样化文本和代码数据令牌进行预训练。 该模型训练了18种编程语言,在使用BigCode的评估工具测试的多种编程语言上,表现出与相似规模模型相比的最新性能。 opencsg-stable-code-3b-v1是基于stable-code-3b的通过全参数微调方法进行调优的模型。
<br>这是基于 stable-code-3b 进行微调的模型版本。
| 模型大小 | 基座模型 |
|---|---|
| 3B | opencsg/Opencsg-stable-coder-3b-v1 |
| opencsg-phi-2-v0.1 | opencsg/Opencsg-phi-2-v0.1 |
HumanEval 是评估模型在代码生成方面性能的最常见的基准,尤其是在代码习题的补全方面。 模型评估在某种程度上是一种玄学。不同的模型对解码方法、参数和指令的敏感度不同, 优秀的大模型是具备通用能力的,而不会因为解码参数的调整使得模型的生成表现有很大的差异。
因此,OpenCSG 提供了一个相对公平的方法来在 HumanEval 基准上比较各微调模型。 方便起见,我们选择了Python语言Pass@1指标,但要注意的是,我们的微调数据集是包含多种编程语言。
为了公平起见,我们仅根据原始问题的提示来评估原始和微调过的 stable-code-3b 模型,不包含任何其他说明。
除此之外,我们在评估过程中对每个模型都使用贪婪解码方法。
| 模型 | HumanEval python pass@1 |
|---|---|
| stable-coder-3b | 29.3% |
| opencsg-stable-coder-3b-v1 | 46.3% |
| phi-2 | 48.2% |
| opencsg-phi-2-v0.1 | 54.3% |
TODO
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("opencsg/opencsg-stable-coder-3b-v1")
model = AutoModelForCausalLM.from_pretrained(
"opencsg/opencsg-stable-coder-3b-v1",
torch_dtype="auto",
)
model.cuda()
inputs = tokenizer("import torch\nimport torch.nn as nn", return_tensors="pt").to(model.device)
tokens = model.generate(
**inputs,
max_new_tokens=48,
temperature=0.2,
do_sample=True,
)
print(tokenizer.decode(tokens[0], skip_special_tokens=True))