Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
@@ -1,16 +1,94 @@
|
|
1 |
-
---
|
2 |
-
title: Salesforce
|
3 |
-
emoji: ⚡
|
4 |
-
colorFrom: indigo
|
5 |
-
colorTo: gray
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 5.23.3
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: apache-2.0
|
11 |
-
|
12 |
-
|
13 |
-
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Salesforce CodeT5 Large Demo
|
3 |
+
emoji: ⚡
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: gray
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 5.23.3
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
+
datasets:
|
12 |
+
- CodeSearchNet/codesearchnet_python
|
13 |
+
- bigcode/the-stack-dedup
|
14 |
+
- codeparrot/codeparrot-clean
|
15 |
+
- openai_humaneval
|
16 |
+
- google/mbpp
|
17 |
+
hf_oauth: true
|
18 |
+
hf_oauth_scopes:
|
19 |
+
- inference-api
|
20 |
+
short_description: Using the powerful Salesforce CodeT5-large model
|
21 |
+
---
|
22 |
+
|
23 |
+
# ⚡ Salesforce CodeT5-large Demo ⚡
|
24 |
+
|
25 |
+
Welcome! This repository/Hugging Face Space hosts a demonstration application for the powerful [Salesforce CodeT5-large](https://huggingface.co/Salesforce/codet5-large) model. It showcases the model's capabilities in various code intelligence tasks using a Gradio interface.
|
26 |
+
|
27 |
+
## About CodeT5-large
|
28 |
+
|
29 |
+
CodeT5 is an advanced encoder-decoder transformer model pre-trained on a vast collection of source code from multiple programming languages alongside natural language text. The `codet5-large` variant excels at tasks such as:
|
30 |
+
|
31 |
+
* **Code Generation:** Creating code snippets from natural language descriptions (e.g., comments, docstrings).
|
32 |
+
* **Code Summarization:** Generating concise natural language summaries for given code blocks.
|
33 |
+
* **Code Translation:** Translating code from one programming language to another.
|
34 |
+
* **Code Refinement:** Improving code quality, fixing bugs, or optimizing code.
|
35 |
+
|
36 |
+
## Using the Demo (Hugging Face Space)
|
37 |
+
|
38 |
+
This application is built with Gradio, providing an interactive web UI.
|
39 |
+
|
40 |
+
1. **Access the Space:** Navigate to the Hugging Face Space hosting this demo.
|
41 |
+
2. **Interact:** Use the input fields provided by the Gradio interface (`app.py`) to interact with the model.
|
42 |
+
* *(Example: You might enter a Python docstring in one box to get the generated function body in another, or input code to get a summary. Please update this section with specific instructions based on your `app.py` functionality!)*
|
43 |
+
3. **Observe:** See the results generated by the CodeT5-large model in the output fields.
|
44 |
+
|
45 |
+
## Running Locally (GitHub / Manual Setup)
|
46 |
+
|
47 |
+
If you prefer to run this demo on your local machine:
|
48 |
+
|
49 |
+
1. **Clone the Repository:**
|
50 |
+
```bash
|
51 |
+
git clone <repository_url> # Replace with HF Space or GitHub repo URL
|
52 |
+
cd <repository_directory>
|
53 |
+
```
|
54 |
+
|
55 |
+
2. **Set up Environment:** (Optional but recommended) Create and activate a virtual environment:
|
56 |
+
```bash
|
57 |
+
python -m venv venv
|
58 |
+
source venv/bin/activate # Linux/macOS
|
59 |
+
# venv\Scripts\activate # Windows
|
60 |
+
```
|
61 |
+
|
62 |
+
3. **Install Dependencies:** Ensure you have Python 3 installed. You'll need Gradio and the necessary libraries for CodeT5 (like `transformers` and `torch`). Create a `requirements.txt` file if one doesn't exist:
|
63 |
+
```plaintext
|
64 |
+
# requirements.txt
|
65 |
+
gradio==5.23.3
|
66 |
+
transformers
|
67 |
+
torch
|
68 |
+
# Add any other specific libraries your app.py needs
|
69 |
+
```
|
70 |
+
Then install:
|
71 |
+
```bash
|
72 |
+
pip install -r requirements.txt
|
73 |
+
```
|
74 |
+
|
75 |
+
4. **Run the Application:**
|
76 |
+
```bash
|
77 |
+
python app.py
|
78 |
+
```
|
79 |
+
|
80 |
+
5. **Access Locally:** Open your web browser and navigate to the URL provided (typically `http://127.0.0.1:7860`).
|
81 |
+
|
82 |
+
## Fine-tuning Datasets for Python & Logic
|
83 |
+
|
84 |
+
The CodeT5 model's performance on specific Python tasks or logical reasoning can be enhanced through fine-tuning. Here are some recommended datasets included in the metadata:
|
85 |
+
|
86 |
+
* [**CodeSearchNet (Python)**](https://huggingface.co/datasets/CodeSearchNet): Excellent for tasks involving matching natural language queries to relevant Python code snippets.
|
87 |
+
* [**The Stack (Deduped)**](https://huggingface.co/datasets/bigcode/the-stack-dedup): A massive, permissively licensed dataset. Filter for Python files (`lang:python`) for broad fine-tuning on diverse Python code.
|
88 |
+
* [**CodeParrot (Clean)**](https://huggingface.co/datasets/codeparrot/codeparrot-clean): A high-quality dataset specifically curated for Python code generation tasks.
|
89 |
+
* [**HumanEval**](https://huggingface.co/datasets/openai_humaneval): A benchmark dataset consisting of Python function programming problems defined by docstrings, ideal for fine-tuning code generation based on specifications and evaluating functional correctness.
|
90 |
+
* [**MBPP (Mostly Basic Python Problems)**](https://huggingface.co/datasets/google/mbpp): Contains around 1,000 crowd-sourced Python programming problems focused on basic concepts, useful for improving generation from descriptions and simple logical problem-solving.
|
91 |
+
|
92 |
+
## License
|
93 |
+
|
94 |
+
This project and the underlying CodeT5 model are distributed under the terms of the [Apache License 2.0](LICENSE). Please refer to the LICENSE file for details.
|