/ Модель

Характеристики

Контекст
16 384 токена
Параметры
6,6 млрд
Размер весов
13,5 ГБ
Лицензия
Apache 2.0
Архитектура
llama · dense
Опубликована
1 апр 2024

Chat2DB-SQL-7B

Генерация текстаТекст → текст7 профессий

Дообученная на CodeLlama модель генерирует SQL-запросы по описаниям на естественном языке и поддерживает несколько SQL-диалектов.

43скачиваний за 30 дней56лайковвеса обновлены2 апр 2024

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Chat2DB-SQL-7B — языковая модель проекта Chat2DB для преобразования запросов на естественном языке в SQL. Она основана на CodeLlama и дообучена для генерации SQL; архитектура — плотная Llama, размер — около 6,6 млрд параметров. Модель работает с контекстом до 16 384 токенов и поддерживает несколько диалектов, включая MySQL, PostgreSQL и SQLite.

Модель подходит для подготовки SQL по текстовому описанию запроса, в том числе с использованием функций и типовых конструкций SQL. В README приведены результаты оценки на Spider для обобщённого SQL, однако гарантии точности для производственного применения нет. Лучше всего модель настроена на MySQL, PostgreSQL и обобщённый SQL; в других диалектах возможны ошибки, особенно в специфичных функциях дат и строк. Лицензия — Apache-2.0.

Сценарии применения

  • создание SQL-запроса по вопросу пользователя
  • подготовка запросов для MySQL по текстовому описанию
  • генерация запросов для PostgreSQL
  • преобразование описаний запросов в SQLite
  • составление SQL с группировкой, сортировкой и функциями

Ограничения

Основная настройка ориентирована на MySQL, PostgreSQL и обобщённый SQL; в специфичных функциях других диалектов возможны ошибки. README не гарантирует точность для производственного использования.

Для каких профессий подходит7

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Chat2DB-GLM

Introduction

Chat2DB-GLM is a part of the open-source project Chat2DB, aimed at providing an efficient way to convert natural language queries into structured SQL statements. The open-sourced Chat2DB-SQL-7B model, with 7B parameters, has been fine-tuned based on CodeLlama. This model is specifically designed for the task of converting natural language to SQL, supports various SQL dialects, and is capable of handling up to 16k of context length.

Dialect Support

The Chat2DB-SQL-7B model supports a wide range of SQL dialects, including but not limited to MySQL, PostgreSQL, SQLite, and other common SQL dialects. This cross-dialect capability ensures the model's broad applicability and flexibility.

Model Performance

The Chat2DB-SQL-7B model has shown excellent performance across multiple dialects and key parts of SQL. Below is an overview of the model's performance on different SQL key parts, using generic SQL as an example, based on evaluations using the spider dataset, demonstrating the model's capability in handling various SQL functions (such as date functions, string functions, etc.).

Dialectselectwheregrouporderfunctiontotal
Generic SQL91.583.780.598.296.277.3

Model Limitations and Usage Notes

The Chat2DB-SQL-7B was mainly fine-tuned for the dialects MySQL, PostgreSQL, and generic SQL. Although the model can provide basic conversion capabilities for other SQL dialects, inaccuracies may occur when dealing with special functions of specific dialects (such as date functions, string functions, etc.). Performance may vary with changes in the dataset.

Please note that this model is primarily intended for academic research and learning purposes. While we strive to ensure the accuracy of the model's output, its performance in a production environment is not guaranteed. Any potential losses incurred from using this model are not the responsibility of this project or its contributors. We encourage users to carefully evaluate its applicability in specific use cases before use.

Model Inference

You can load the model via transformers and use the Chat2DB-SQL-7B model with the following sample code snippet. The model's performance may vary depending on the prompt, so please try to follow the prompt format provided in the example below. The model_path in the code block can be replaced with your local model path.

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
model_path = "Chat2DB/Chat2DB-SQL-7B" # This can be replaced with your local model path
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto", trust_remote_code=True, torch_dtype=torch.float16, use_cache=True)
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, return_full_text=False, max_new_tokens=100)
prompt = "### Database Schema\n\n['CREATE TABLE \"stadium\" (\\n\"Stadium_ID\" int,\\n\"Location\" text,\\n\"Name\" text,\\n\"Capacity\" int,\\n\"Highest\" int,\\n\"Lowest\" int,\\n\"Average\" int,\\nPRIMARY KEY (\"Stadium_ID\")\\n);', 'CREATE TABLE \"singer\" (\\n\"Singer_ID\" int,\\n\"Name\" text,\\n\"Country\" text,\\n\"Song_Name\" text,\\n\"Song_release_year\" text,\\n\"Age\" int,\\n\"Is_male\" bool,\\nPRIMARY KEY (\"Singer_ID\")\\n);', 'CREATE TABLE \"concert\" (\\n\"concert_ID\" int,\\n\"concert_Name\" text,\\n\"Theme\" text,\\n\"Stadium_ID\" text,\\n\"Year\" text,\\nPRIMARY KEY (\"concert_ID\"),\\nFOREIGN KEY (\"Stadium_ID\") REFERENCES \"stadium\"(\"Stadium_ID\")\\n);', 'CREATE TABLE \"singer_in_concert\" (\\n\"concert_ID\" int,\\n\"Singer_ID\" text,\\nPRIMARY KEY (\"concert_ID\",\"Singer_ID\"),\\nFOREIGN KEY (

\"concert_ID\") REFERENCES \"concert\"(\"concert_ID\"),\\nFOREIGN KEY (\"Singer_ID\") REFERENCES \"singer\"(\"Singer_ID\")\\n);']\n\n\n### Task \n\nBased on the provided database schema information, How many singers do we have?[SQL]\n"
response = pipe(prompt)[0]["generated_text"]
print(response)

Hardware Requirements

ModelMinimum GPU Memory (Inference)Minimum GPU Memory (Efficient Parameter Fine-Tuning)
Chat2DB-SQL-7B14GB20GB

Contribution Guide

We welcome and encourage community members to contribute to the Chat2DB-GLM project. Whether it's by reporting issues, proposing new features, or directly submitting code fixes and improvements, your help is invaluable.

If you're interested in contributing, please follow our contribution guidelines:

Report Issues: Report any issues or bugs encountered via GitHub Issues. Submit Pull Requests: If you wish to contribute directly to the codebase, please fork the repository and submit a pull request (PR). Improve Documentation: Contributions to best practices, example code, documentation improvements, etc., are welcome.

License

The model weights in this project is governed by a custom commercial license from Code Llama. For details, please visit: Custom Commercial License

Before using this software, please ensure you have fully understood the terms of the license.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Можно запустить

Подбираем GPU…

Класс архитектуры
LlamaForCausalLM
Ревизия весов
8aaae99

0 моделей