File size: 4,602 Bytes
eca329a
 
 
 
 
 
ef4c368
eca329a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
836afb3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
title: Salesforce CodeT5 Large Demo
emoji: 
colorFrom: indigo
colorTo: gray
sdk: gradio
sdk_version: 5.24.0
app_file: app.py
pinned: false
license: apache-2.0
datasets:
- CodeSearchNet/codesearchnet_python
- bigcode/the-stack-dedup
- codeparrot/codeparrot-clean
- openai_humaneval
- google/mbpp
- nvidia/OpenCodeReasoning
hf_oauth: true
hf_oauth_scopes:
- inference-api
short_description: Using the powerful Salesforce CodeT5-large model
---

# ⚡ Salesforce CodeT5-large Demo ⚡

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.

## About CodeT5-large

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:

* **Code Generation:** Creating code snippets from natural language descriptions (e.g., comments, docstrings).
* **Code Summarization:** Generating concise natural language summaries for given code blocks.
* **Code Translation:** Translating code from one programming language to another.
* **Code Refinement:** Improving code quality, fixing bugs, or optimizing code.

## Using the Demo (Hugging Face Space)

This application is built with Gradio, providing an interactive web UI.

1.  **Access the Space:** Navigate to the Hugging Face Space hosting this demo.
2.  **Interact:** Use the input fields provided by the Gradio interface (`app.py`) to interact with the model.
    * *(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!)*
3.  **Observe:** See the results generated by the CodeT5-large model in the output fields.

## Running Locally (GitHub / Manual Setup)

If you prefer to run this demo on your local machine:

1.  **Clone the Repository:**
    ```bash
    git clone <repository_url> # Replace with HF Space or GitHub repo URL
    cd <repository_directory>
    ```

2.  **Set up Environment:** (Optional but recommended) Create and activate a virtual environment:
    ```bash
    python -m venv venv
    source venv/bin/activate # Linux/macOS
    # venv\Scripts\activate # Windows
    ```

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:
    ```plaintext
    # requirements.txt
    gradio==5.23.3
    transformers
    torch
    # Add any other specific libraries your app.py needs
    ```
    Then install:
    ```bash
    pip install -r requirements.txt
    ```

4.  **Run the Application:**
    ```bash
    python app.py
    ```

5.  **Access Locally:** Open your web browser and navigate to the URL provided (typically `http://127.0.0.1:7860`).

## Fine-tuning Datasets for Python & Logic

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:

* [**CodeSearchNet (Python)**](https://huggingface.co./datasets/CodeSearchNet): Excellent for tasks involving matching natural language queries to relevant Python code snippets.
* [**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.
* [**CodeParrot (Clean)**](https://huggingface.co./datasets/codeparrot/codeparrot-clean): A high-quality dataset specifically curated for Python code generation tasks.
* [**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.
* [**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.

## License

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.