Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# GPT-Code-Clippy-125M-Code-Search-Py
|
2 |
+
|
3 |
+
## Model Description
|
4 |
+
|
5 |
+
GPT-CC-125M-Code-Search is a [GPT-Neo-125M model](https://huggingface.co/EleutherAI/gpt-neo-125M) finetuned using causal language modeling on only the python language in the [CodeSearchNet Challenge dataset](https://huggingface.co/datasets/code_search_net). This model is specialized to autocomplete methods in multiple the python language.
|
6 |
+
|
7 |
+
## Training data
|
8 |
+
|
9 |
+
[CodeSearchNet Challenge dataset](https://huggingface.co/datasets/code_search_net).
|
10 |
+
|
11 |
+
## Training procedure
|
12 |
+
|
13 |
+
The training script used to train this model can be found [here](https://github.com/ncoop57/gpt-code-clippy/blob/camera-ready/training/run_clm_apps.py).
|
14 |
+
|
15 |
+
## Intended Use and Limitations
|
16 |
+
|
17 |
+
The model is finetuned methods from the python language and is intended to autocomplete python methods given some prompt (method signature and docstring).
|
18 |
+
|
19 |
+
### How to use
|
20 |
+
|
21 |
+
You can use this model directly with a pipeline for text generation. This example generates a different sequence each time it's run:
|
22 |
+
|
23 |
+
```py
|
24 |
+
|
25 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, FlaxAutoModelForCausalLM
|
26 |
+
|
27 |
+
model = AutoModelForCausalLM.from_pretrained("flax-community/gpt-neo-125M-code-clippy-code-search-py")
|
28 |
+
|
29 |
+
tokenizer = AutoTokenizer.from_pretrained("flax-community/gpt-neo-125M-code-clippy-code-search-py")
|
30 |
+
|
31 |
+
prompt = """def greet(name):
|
32 |
+
'''A function to greet user. Given a user name it should say hello'''
|
33 |
+
"""
|
34 |
+
|
35 |
+
input_ids = tokenizer(prompt, return_tensors='pt').input_ids.to(device)
|
36 |
+
|
37 |
+
start = input_ids.size(1)
|
38 |
+
|
39 |
+
out = model.generate(input_ids, do_sample=True, max_length=50, num_beams=2,
|
40 |
+
|
41 |
+
early_stopping=True, eos_token_id=tokenizer.eos_token_id, )
|
42 |
+
|
43 |
+
print(tokenizer.decode(out[0][start:]))
|
44 |
+
|
45 |
+
```
|
46 |
+
|
47 |
+
### Limitations and Biases
|
48 |
+
|
49 |
+
The model is intended to be used for research purposes and comes with no guarantees of quality of generated code.
|
50 |
+
|
51 |
+
GPT-CC is finetuned from GPT-Neo and might have inherited biases and limitations from it. See [GPT-Neo model card](https://huggingface.co/EleutherAI/gpt-neo-125M#limitations-and-biases) for details.
|
52 |
+
|
53 |
+
## Eval results
|
54 |
+
|
55 |
+
Coming soon...
|