初始化项目,由ModelHub XC社区提供模型
Model: codeparrot/codeparrot-small-multi Source: Original Platform
This commit is contained in:
27
.gitattributes
vendored
Normal file
27
.gitattributes
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
*.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
|
||||
*.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
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack 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
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* 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
|
||||
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
75
README.md
Normal file
75
README.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
language:
|
||||
- code
|
||||
license: apache-2.0
|
||||
tags:
|
||||
- code
|
||||
- gpt2
|
||||
- generation
|
||||
datasets:
|
||||
- "codeparrot/github-code-clean"
|
||||
- "openai_humaneval"
|
||||
metrics:
|
||||
- "evaluate-metric/code_eval"
|
||||
---
|
||||
|
||||
# CodeParrot-Multi 🦜 (small)
|
||||
|
||||
CodeParrot-Multi 🦜 is a GPT-2 model (110M parameters) trained to generate code in 9 programming languages: "Java", "JavaScript", "PHP", "Python", "C#", "C++", "GO", "Ruby" and "TypeScript".
|
||||
|
||||
## Usage
|
||||
|
||||
You can load the CodeParrot-Multi model and tokenizer directly in `transformers`:
|
||||
|
||||
```Python
|
||||
from transformers import AutoTokenizer, AutoModelWithLMHead
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained("codeparrot/codeparrot-small-multi")
|
||||
model = AutoModelWithLMHead.from_pretrained("codeparrot/codeparrot-small-multi")
|
||||
|
||||
inputs = tokenizer("def hello_world():", return_tensors="pt")
|
||||
outputs = model(**inputs)
|
||||
```
|
||||
|
||||
or with a `pipeline`:
|
||||
|
||||
```Python
|
||||
from transformers import pipeline
|
||||
|
||||
pipe = pipeline("text-generation", model="codeparrot/codeparrot-small-multi")
|
||||
outputs = pipe("def hello_world():")
|
||||
```
|
||||
|
||||
## Training
|
||||
|
||||
The model was trained on the small [Github code small](https://huggingface.co/datasets/loubnabnl/github-small-near-dedup) after near deduplication, a subset of [Github code dataset](https://huggingface.co/datasets/codeparrot/github-code-clean) with the following settings:
|
||||
|
||||
|Config|Value|
|
||||
|-------|-----|
|
||||
|Batch size| 192 |
|
||||
|Context size| 1024 |
|
||||
|Training steps| 300'000|
|
||||
|Gradient accumulation| 2|
|
||||
|Gradient checkpointing| False|
|
||||
|Learning rate| 5e-4 |
|
||||
|Weight decay | 0.1 |
|
||||
|Warmup steps| 2000 |
|
||||
|Schedule| Cosine |
|
||||
|
||||
The training was executed on 16 x A100 (40GB) GPUs. This setting amounts to roughly 58 billion tokens.
|
||||
|
||||
## Performance
|
||||
|
||||
We evaluated the model on OpenAI's [HumanEval](https://huggingface.co/datasets/openai_humaneval) benchmark which consists of programming challenges:
|
||||
|
||||
| Metric | Value |
|
||||
|-------|-----|
|
||||
|pass@1 | --% |
|
||||
|pass@10 | --% |
|
||||
|pass@100 | --% |
|
||||
|
||||
The [pass@k metric](https://huggingface.co/metrics/code_eval) tells the probability that at least one out of k generations passes the tests.
|
||||
|
||||
## Resources
|
||||
|
||||
- Code: [repository](https://github.com/huggingface/transformers/tree/master/examples/research_projects/codeparrot)
|
||||
31
config.json
Normal file
31
config.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"activation_function": "gelu_fast",
|
||||
"architectures": [
|
||||
"GPT2LMHeadModel"
|
||||
],
|
||||
"attn_pdrop": 0.1,
|
||||
"bos_token_id": 50256,
|
||||
"embd_pdrop": 0.1,
|
||||
"eos_token_id": 50256,
|
||||
"initializer_range": 0.02,
|
||||
"layer_norm_epsilon": 1e-05,
|
||||
"model_type": "gpt2",
|
||||
"n_embd": 768,
|
||||
"n_head": 12,
|
||||
"n_inner": 3072,
|
||||
"n_layer": 12,
|
||||
"n_positions": 1024,
|
||||
"reorder_and_upcast_attn": false,
|
||||
"resid_pdrop": 0.1,
|
||||
"scale_attn_by_inverse_layer_idx": false,
|
||||
"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,
|
||||
"tokenizer_class": "GPT2TokenizerFast",
|
||||
"transformers_version": "4.19.0",
|
||||
"use_cache": true,
|
||||
"vocab_size": 32768
|
||||
}
|
||||
3
eval_results.txt
Normal file
3
eval_results.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
temperature 0.2: {'pass@1': 0.027439024390243896, 'pass@10': 0.041979293327556816, 'pass@100': 0.04268292682926801}
|
||||
temperature 0.8: {'pass@1': 0.013262195121951224, 'pass@10': 0.04670902438514701, 'pass@100': 0.0899080946922357}
|
||||
best: {'pass@1': 2.74% , 'pass@10': 4.67 , 'pass@100': 8.99%}
|
||||
32512
merges.txt
Normal file
32512
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
pytorch_model.bin
Normal file
3
pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0207f6b427e3cbf1bcb9726abb6bbba6620e9912e1abf23087ccdef61818ffb2
|
||||
size 247234217
|
||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user