pipeline_tag: 文本生成
inference: true
widget:
-
text: 'def print_hello_world():'
example_title: Hello world
group: Python
license: bigcode-openrail-m
datasets:
-
bigcode/the-stack-dedup
metrics:
-
代码评估
library_name: transformers
tags:
-
代码
model-index:
-
name: StarCoderBase-1B
results:
- task:
type: 文本生成
dataset:
type: openai_humaneval
name: HumanEval
metrics:
- name: pass@1
type: pass@1
value: 15.17
verified: false
- task:
type: 文本生成
dataset:
type: nuprl/MultiPL-E
name: MultiPL-HumanEval (C++)
metrics:
- name: pass@1
type: pass@1
value: 11.68
verified: false
- task:
type: 文本生成
dataset:
type: nuprl/MultiPL-E
name: MultiPL-HumanEval (Java)
metrics:
- name: pass@1
type: pass@1
value: 14.2
verified: false
- task:
type: 文本生成
dataset:
type: nuprl/MultiPL-E
name: MultiPL-HumanEval (JavaScript)
metrics:
- name: pass@1
type: pass@1
value: 13.38
verified: false
- task:
type: 文本生成
dataset:
type: nuprl/MultiPL-E
name: MultiPL-HumanEval (PHP)
metrics:
- name: pass@1
type: pass@1
value: 9.94
verified: false
- task:
type: 文本生成
dataset:
type: nuprl/MultiPL-E
name: MultiPL-HumanEval (Lua)
metrics:
- name: pass@1
type: pass@1
value: 12.52
verified: false
- task:
type: 文本生成
dataset:
type: nuprl/MultiPL-E
name: MultiPL-HumanEval (Rust)
metrics:
- name: pass@1
type: pass@1
value: 10.24
verified: false
- task:
type: 文本生成
dataset:
type: nuprl/MultiPL-E
name: MultiPL-HumanEval (Swift)
metrics:
- name: pass@1
type: pass@1
value: 3.92
verified: false
- task:
type: 文本生成
dataset:
type: nuprl/MultiPL-E
name: MultiPL-HumanEval (Julia)
metrics:
- name: pass@1
type: pass@1
value: 11.31
verified: false
- task:
type: 文本生成
dataset:
type: nuprl/MultiPL-E
name: MultiPL-HumanEval (R)
metrics:
- name: pass@1
type: pass@1
value: 5.37
verified: false
extra_gated_prompt: >-
模型许可协议
在同意之前,请阅读BigCode的OpenRAIL-M许可协议。
extra_gated_fields:
我接受上述许可协议,并将按照使用限制和共享要求使用该模型: checkbox
duplicated_from: bigcode-data/starcoderbase-1b
StarCoderBase-1B
StarCoderBase的1B参数版本。
目录
- 模型概述
- 使用
- 限制
- 训练
- 许可
- 引用
模型概述
StarCoderBase-1B是一个10亿参数的模型,基于The Stack (v1.2)中的80多种编程语言训练,排除了退出请求的数据。该模型采用多查询注意力机制,8192个标记的上下文窗口,并通过填充中间目标在1万亿标记上进行训练。
使用
预期用途
该模型基于GitHub代码训练。因此,它不是一个指令模型,像“编写一个计算平方根的函数”这样的命令效果不佳。但通过使用技术助手提示,可以将其转变为能力强的技术助手。
欢迎在社区标签下分享您的生成结果!
生成
from transformers import AutoModelForCausalLM, AutoTokenizer
checkpoint = "bigcode/starcoderbase-1b"
device = "cuda"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
填充中间
填充中间使用特殊标记来标识输入和输出的前缀/中间/后缀部分:
input_text = "<fim_prefix>def print_hello_world():\n <fim_suffix>\n print('Hello world!')<fim_middle>"
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
归属及其他要求
模型的预训练数据集仅筛选了宽松许可的代码。尽管如此,模型仍可能生成与数据集中完全相同的源代码。代码的许可可能要求归属或其他特定要求,必须遵守。我们提供了一个搜索索引,可用于搜索预训练数据,以确定生成代码的来源,并为您的代码应用适当的归属。
限制
该模型基于80多种编程语言的源代码训练。源代码中的主要自然语言是英语,但也包含其他语言。因此,该模型能够在提供一定上下文的情况下生成代码片段,但生成的代码不能保证按预期工作。它可能效率低下、包含错误或漏洞。详见论文中对模型限制的深入讨论。
训练
模型
- 架构: 采用多查询注意力和填充中间目标的GPT-2模型
- 预训练步数: 50万
- 预训练标记: 1万亿
- 精度: bfloat16
硬件
- GPU: 128块Tesla A100
- 训练时间: 11天
软件
许可
该模型采用BigCode OpenRAIL-M v1许可协议。完整协议可在此处查看。
引用
@article{li2023starcoder,
title={StarCoder: 愿源代码与你同在!},
author={Raymond Li and Loubna Ben Allal and Yangtian Zi and Niklas Muennighoff and Denis Kocetkov and Chenghao Mou and Marc Marone and Christopher Akiki and Jia Li and Jenny Chim and Qian Liu and Evgenii Zheltonozhskii and Terry Yue Zhuo and Thomas Wang and Olivier Dehaene and Mishig Davaadorj and Joel Lamy-Poirier and João Monteiro and Oleh Shliazhko and Nicolas Gontier and Nicholas Meade and Armel Zebaze and Ming-Ho Yee and Logesh Kumar Umapathi and Jian Zhu and Benjamin Lipkin and Muhtasham Oblokulov and Zhiruo Wang and Rudra Murthy and Jason Stillerman and Siva Sankalp Patel and Dmitry Abulkhanov and Marco Zocca and Manan Dey and Zhihan Zhang and Nour Fahmy and Urvashi Bhattacharyya and Wenhao Yu and Swayam Singh and Sasha Luccioni and Paulo Villegas and Maxim Kunakov and Fedor Zhdanov and Manuel Romero and Tony Lee and Nadav Timor and Jennifer Ding and Claire Schlesinger and Hailey Schoelkopf and Jan Ebert and Tri Dao and Mayank Mishra and Alex Gu and Jennifer Robinson and Carolyn Jane Anderson and Brendan Dolan-Gavitt and Danish Contractor and Siva Reddy and Daniel Fried and Dzmitry Bahdanau and Yacine Jernite and Carlos Muñoz Ferrandis and Sean Hughes and Thomas Wolf and Arjun Guha and Leandro von Werra and Harm de Vries},
year={2023},
eprint={2305.06161},
archivePrefix={arXiv},
primaryClass={cs.CL}
}