Metadata-Version: 2.4
Name: curie-backend
Version: 0.1.0
Summary: Text2SQL Assistant Backend
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: fastapi[standard]>=0.110.0
Requires-Dist: uvicorn>=0.28.0
Requires-Dist: torch>=2.1.0
Requires-Dist: transformers>=4.38.0
Requires-Dist: peft>=0.9.0
Requires-Dist: accelerate>=0.27.0
Requires-Dist: SQLAlchemy>=2.0.0
Requires-Dist: psycopg[binary]>=3.1.0
Requires-Dist: huggingface-hub>=0.21.0
Requires-Dist: python-dotenv>=1.0.0

# Project Curie - Text2SQL



## Project description
* **Idea:** Use natural language prompts to generate SQL queries 
* **Front-end: VS Code Plugin**
  * Integration of trained LLM into useful plugin with quick insights 
  * Establish connection with existing database 
  * Use natural language to describe queries to this database, which are generated by fine-tuned LLM 
  * Ability to run generated SQL code directly via plugin to see results immediately with no bothersome copying

* ...

### Simple example: 
![simple_example.png](other/diagrams/simple_example.png)

## Project structure

```text
evaluation/   Benchmark setups for Text-to-SQL evaluation
data/         Local datasets and sample data
docs/         Project documentation, presentations, and research notes
experiments/  Ongoing fine-tuning experiments and run notes
extension/    VS Code extension and demo database
ml/           Training, fine-tuning, and inference code
ml/models/    Model metadata, configs, and model cards
```

## Project team and responsibilities

| Name              | E-Mail                   | Identifier | Responsibilities / tasks |
|-------------------|--------------------------|------------|--------------------------|
| Tamer Lewis       | tamer.lewis@tum.de       | go68maj    | TBD                      |
| Antonia Gilles    | antonia.gilles@tum.de    | go34cih    | TBD                      |
| Leon Pfänder      | leon.pfaender@tum.de     | ge27fob    | TBD                      |
| Christoph Klein   | christoph.m.klein@tum.de | ge42low    | TBD                      |




## Project setup

The project uses Python 3.12 and a pinned ML stack from `requirements.txt`.

```bash
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
```

Verify that the installed dependencies are consistent:

```bash
python -m pip check
```

### Git LFS for model weights

Git LFS stores large model binaries on the GitLab LFS server while Git tracks
small pointer files. This repository uses LFS for `*.safetensors` files.

Minimal setup:

```bash
brew install git-lfs
git lfs install
git lfs pull
```

Add and push model weights through the normal Git workflow:

```bash
git add .gitattributes ml/models/<model>/adapter_model.safetensors
git commit -m "Add model adapter"
git push
```

After cloning, Git LFS normally downloads tracked files automatically. If a model file is only an LFS pointer or is missing, run `git lfs pull`. Verify the available model files with `git lfs ls-files`.

LFS does not change how the benchmark is invoked:

```bash
python3 evaluation/spider/run.py \
  --split dev \
  --model-dir ml/models/<model>
```

### Spider

Download the Spider dataset and place it in the `data/` folder:

https://drive.google.com/file/d/1403EGqzIDoHMdQF4c9Bkyl7dZLZ5Wt6J/view

## Sources

TBD
