Update README.md
Browse files
README.md
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- Explain code
|
| 5 |
+
- Code Summarization
|
| 6 |
+
|
| 7 |
+
license: mit
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
# Gemini
|
| 12 |
+
|
| 13 |
+
## Model description
|
| 14 |
+
|
| 15 |
+
Gemini is a transformer based on Google's T5 model. The model is pre-trained on approximately 800k code/description pairs and then fine-tuned on 10k higher-level explanations that were synthetically generated. Gemini is capable of summarization/explaining short to medium code snippets in:
|
| 16 |
+
|
| 17 |
+
- Python
|
| 18 |
+
- Javascript (mostly vanilla JS, however, it can handle frameworks like React as well)
|
| 19 |
+
- Java
|
| 20 |
+
- Ruby
|
| 21 |
+
- Go
|
| 22 |
+
|
| 23 |
+
And outputs a description in English.
|
| 24 |
+
|
| 25 |
+
## Intended uses & limitations
|
| 26 |
+
|
| 27 |
+
Gemini without any additional fine-tuning is capable of explaining code in a sentence or two and typically performs best in Python and Javascript. We recommend using Gemini for either simple code explanation, documentation or producing more synthetic data to improve its explanations.
|
| 28 |
+
|
| 29 |
+
### How to use
|
| 30 |
+
|
| 31 |
+
You can use this model directly with a pipeline for Text2Text generation, as shown below:
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
from transformers import pipeline, set_seed
|
| 35 |
+
|
| 36 |
+
summarizer = pipeline('text2text-generation', model='describeai/gemini')
|
| 37 |
+
code = "print('hello world!')"
|
| 38 |
+
|
| 39 |
+
response = "Summarized code: "+ summarizer(code, max_length=100, num_beams=3)
|
| 40 |
+
print(response)
|
| 41 |
+
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
Which should yield something along the lines of:
|
| 45 |
+
|
| 46 |
+
```
|
| 47 |
+
Summarized code: The following code is greeting the world.
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
### Limitations
|
| 53 |
+
|
| 54 |
+
Typically, Gemini may produce overly simplistic descriptions that don't encompass the entire code snippet. We suspect with more training data, this could be circumvented and will produce better results.
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
### About Us
|
| 58 |
+
|
| 59 |
+
A Describe.ai, we are focused on building Artificial Intelligence systems that can understand language as well as humans. While a long path, we plan to contribute our findings to our API to the Open Source community.
|