初始化项目,由ModelHub XC社区提供模型

Model: jinaai/starcoder-1b-textbook
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-04-26 14:22:56 +08:00
commit a6556e96c0
11 changed files with 147382 additions and 0 deletions

35
.gitattributes vendored Normal file
View File

@@ -0,0 +1,35 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text

90
README.md Normal file
View File

@@ -0,0 +1,90 @@
---
model-index:
- name: starcoder-1b-textbook
results:
- task:
type: text-generation
dataset:
type: openai_humaneval
name: HumanEval
metrics:
- name: pass@1
type: pass@1
value: 27.0%
verified: false
datasets:
- jinaai/code_exercises
language:
- en
tags:
- HumanEval
- StarCoder
license: cc-by-nc-sa-4.0
---
# StarCoder-1b-textbook
StarCoder-1b-textbook is a finetuned version of [starcoderbase-1b](https://huggingface.co/bigcode/starcoderbase-1b) on the [code_exercices](https://huggingface.co/datasets/jinaai/code_exercises) dataset
It achieves 27.0 pass@1 on the [Human Eval](https://github.com/openai/human-eval) coding benchmark while being only 1b parameters.
That is an improvement of almost 12 points over the starcoder 1b baseline, almost doubling the score.
The results (on the human eval benchmark) are on par with other open-source models like StarCoderBase (30.4) StarCoder(33.6) CodeGen-16B-Mono(29.3) while the model being 15 times smaller.
It still underperforms compared to other models like CodeLLama (53%) chat gpt 4 (82) or wizard coder (73.2), but these model are more than 30 times bigger.
## Usage
You can download and use the model like so:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"jinaai/starcoder-1b-textbook", device_map='auto'
)
tokenizer = AutoTokenizer.from_pretrained("jinaai/starcoder-1b-textbook")
prompt = '''
def unique(l: list):
"""Return sorted unique elements in a list
>>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123])
[0, 2, 3, 5, 9, 123]
"""
'''
inputs = tokenizer(prompt.rstrip(), return_tensors="pt").to("cuda")
generation_output = model.generate(
**inputs,
max_new_tokens=128,
eos_token_id=tokenizer.eos_token_id,
return_dict_in_generate=True,
)
s = generation_output.sequences[0]
output = tokenizer.decode(s, skip_special_tokens=True)
print(output)
```
## Finetuning details
We did full parameter fine-tuning and used a Nvidia a40 for 12 hours using a batch size of 128 and a micro-batch size of 8.
To reproduce the training just follow the training instructions in our [open source codebase](https://github.com/jina-ai/textbook)
## Disclaimer
* The human eval benchmark is not a perfect benchmark and does not fully represent the coding abilities of an LLM. This model performs well on the task described in the benchmark but it does not necessarily mean that our model is on par with bigger models on coding assistant LLM.
* This model is not an instruction tuned model and cannot be used as a chatbot. We recommend using the [Evol-Instruct-Code-80k-v1](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) to finetune it into a instrution following model
* This model has not been aligned with human preferences and therefore could potentially generate harmful content
* This model has been trained on a dataset generated by ChatGPT 3.5, and you should check the legal status of AI-generated content in your jurisdiction before using it. You should make sure that your usage complies with the OpenAI Terms of Use, in so far as legally applicable.
## Credits
This model was trained and released by [Jina.ai](https://jina.ai/)

39
config.json Normal file
View File

@@ -0,0 +1,39 @@
{
"_name_or_path": "bigcode/starcoderbase-1b",
"activation_function": "gelu_pytorch_tanh",
"architectures": [
"GPTBigCodeForCausalLM"
],
"attention_softmax_in_fp32": true,
"attn_pdrop": 0.1,
"bos_token_id": 0,
"embd_pdrop": 0.1,
"eos_token_id": 0,
"inference_runner": 0,
"initializer_range": 0.02,
"layer_norm_epsilon": 1e-05,
"max_batch_size": null,
"max_sequence_length": null,
"model_type": "gpt_bigcode",
"multi_query": true,
"n_embd": 2048,
"n_head": 16,
"n_inner": 8192,
"n_layer": 24,
"n_positions": 8192,
"pad_key_length": true,
"pre_allocate_kv_cache": false,
"resid_pdrop": 0.1,
"scale_attention_softmax_in_fp32": true,
"scale_attn_weights": true,
"summary_activation": null,
"summary_first_dropout": 0.1,
"summary_proj_to_labels": true,
"summary_type": "cls_index",
"summary_use_proj": true,
"torch_dtype": "float32",
"transformers_version": "4.31.0",
"use_cache": true,
"validate_runner_input": true,
"vocab_size": 49152
}

1
configuration.json Normal file
View File

@@ -0,0 +1 @@
{"framework": "pytorch", "task": "text-generation", "allow_remote": true}

6
generation_config.json Normal file
View File

@@ -0,0 +1,6 @@
{
"_from_model_config": true,
"bos_token_id": 0,
"eos_token_id": 0,
"transformers_version": "4.31.0"
}

48892
merges.txt Normal file

File diff suppressed because it is too large Load Diff

3
pytorch_model.bin Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:22e2ebd6c08e650edf4959ba737a5337c15ce36952d7144bcb0dbd77c9dc77a0
size 4548924617

27
special_tokens_map.json Normal file
View File

@@ -0,0 +1,27 @@
{
"additional_special_tokens": [
"<|endoftext|>",
"<fim_prefix>",
"<fim_middle>",
"<fim_suffix>",
"<fim_pad>",
"<filename>",
"<gh_stars>",
"<issue_start>",
"<issue_comment>",
"<issue_closed>",
"<jupyter_start>",
"<jupyter_text>",
"<jupyter_code>",
"<jupyter_output>",
"<empty_output>",
"<commit_before>",
"<commit_msg>",
"<commit_after>",
"<reponame>"
],
"bos_token": "<|endoftext|>",
"eos_token": "<|endoftext|>",
"pad_token": "<|endoftext|>",
"unk_token": "<|endoftext|>"
}

98257
tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

31
tokenizer_config.json Normal file
View File

@@ -0,0 +1,31 @@
{
"add_prefix_space": false,
"additional_special_tokens": [
"<|endoftext|>",
"<fim_prefix>",
"<fim_middle>",
"<fim_suffix>",
"<fim_pad>",
"<filename>",
"<gh_stars>",
"<issue_start>",
"<issue_comment>",
"<issue_closed>",
"<jupyter_start>",
"<jupyter_text>",
"<jupyter_code>",
"<jupyter_output>",
"<empty_output>",
"<commit_before>",
"<commit_msg>",
"<commit_after>",
"<reponame>"
],
"bos_token": "<|endoftext|>",
"clean_up_tokenization_spaces": true,
"eos_token": "<|endoftext|>",
"model_max_length": 1000000000000000019884624838656,
"tokenizer_class": "GPT2Tokenizer",
"unk_token": "<|endoftext|>",
"vocab_size": 49152
}

1
vocab.json Normal file

File diff suppressed because one or more lines are too long