Views
No views yet
| Name | Quant method | Bits |
|---|---|---|
| DuckDB-NSQL-7B-v0.1-f16.gguf | - | 16 |
| DuckDB-NSQL-7B-v0.1-q8_0.gguf | Q8_0 | 8 |
SELECT statements, but can generate any valid DuckDB SQL statement, including statements for official DuckDB extensions.1CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
2huggingface-cli download motherduckdb/DuckDB-NSQL-7B-v0.1-GGUF DuckDB-NSQL-7B-v0.1-q8_0.gguf --local-dir . --local-dir-use-symlinks False
3pip install wurlitzer1## Setup - Llama.cpp
2from llama_cpp import Llama
3with pipes() as (out, err):
4 llama = Llama(
5 model_path="DuckDB-NSQL-7B-v0.1-q8_0.gguf",
6 n_ctx=2048,
7 )
8
9text = """### Instruction:
10Your task is to generate valid duckdb SQL to answer the following question.
11
12### Input:
13
14### Question:
15create a new table called tmp from test.csv
16
17### Response (use duckdb shorthand if possible):
18"""
19
20with pipes() as (out, err):
21 pred = llama(text, temperature=0.1, max_tokens=500)
22print(pred["choices"][0]["text"])1from llama_cpp import Llama
2with pipes() as (out, err):
3 llama = Llama(
4 model_path="DuckDB-NSQL-7B-v0.1-q8_0.gguf",
5 n_ctx=2048,
6 )
7
8text = """### Instruction:
9Your task is to generate valid duckdb SQL to answer the following question, given a duckdb database schema.
10
11### Input:
12Here is the database schema that the SQL query will run on:
13CREATE TABLE taxi (
14 VendorID bigint,
15 tpep_pickup_datetime timestamp,
16 tpep_dropoff_datetime timestamp,
17 passenger_count double,
18 trip_distance double,
19 fare_amount double,
20 extra double,
21 tip_amount double,
22 tolls_amount double,
23 improvement_surcharge double,
24 total_amount double,
25);
26
27### Question:
28get all columns ending with _amount from taxi table
29
30### Response (use duckdb shorthand if possible):"""
31
32with pipes() as (out, err):
33 pred = llama(text, temperature=0.1, max_tokens=500)
34print(pred["choices"][0]["text"])1from llama_cpp import Llama
2with pipes() as (out, err):
3 llama = Llama(
4 model_path="DuckDB-NSQL-7B-v0.1-q8_0.gguf",
5 n_ctx=2048,
6 )
7
8text = """### Instruction:
9Your task is to generate valid duckdb SQL to answer the following question, given a duckdb database schema.
10
11### Input:
12Here is the database schema that the SQL query will run on:
13CREATE TABLE rideshare (
14 hvfhs_license_num varchar,
15 dispatching_base_num varchar,
16 originating_base_num varchar,
17 request_datetime timestamp,
18 on_scene_datetime timestamp,
19 pickup_datetime timestamp,
20 dropoff_datetime timestamp,
21 trip_miles double,
22 trip_time bigint,
23
24);
25
26### Question:
27get longest trip in december 2022
28
29### Response (use duckdb shorthand if possible):
30"""
31
32with pipes() as (out, err):
33 pred = llama(text, temperature=0.1, max_tokens=500)
34print(pred["choices"][0]["text"])