Downloads · 30 days
16
14% of all-time downloads
namuai-x/CypressTree-1.0-7B
CypressTree-1.0-7B is a text generation model from namuai-x. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
CypressTree-1.0-7B는 한국어 자연어 질의를 SQL 쿼리로 변환하는 데 특화된 7B 파라미터 언어 모델입니다. 복잡한 데이터베이스 스키마와 한국어 질문의 의도를 깊이 이해하여, 정확하고 효율적인 SQL 쿼리를 생성하도록 설계되었습니다.
Downloads · 30 days
16
14% of all-time downloads
All-time downloads
117
Public
Parameters
7.6B
43.5 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors15.2 GB · 100%
From the Hugging Face model README
CypressTree-1.0-7B는 한국어 자연어 질의를 SQL 쿼리로 변환하는 데 특화된 7B 파라미터 언어 모델입니다. 복잡한 데이터베이스 스키마와 한국어 질문의 의도를 깊이 이해하여, 정확하고 효율적인 SQL 쿼리를 생성하도록 설계되었습니다.
Alibaba의 Qwen2 아키텍처를 기반으로, daje/kotext-to-sql-v1 데이터셋을 활용하여 한국어 SQL 생성 능력을 고도화했습니다.
주요 특징:
JOIN, 서브쿼리, 복합 WHERE 조건 등 높은 복잡도의 SQL 구문을 정확하게 생성합니다.import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
# 1. 모델과 토크나이저 로드
model_id = "namuai-x/CypressTree-1.0-7B"
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
# 2. 프롬프트 구성 (복잡한 Multi-JOIN 예시)
question = "보스턴에서 샌프란시스코로 비행하는 항공사는 어떤 것들이 있나요?"
schema = """
CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT);
CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR);
CREATE TABLE city (city_code VARCHAR, city_name VARCHAR);
CREATE TABLE flight (airline_code VARCHAR, from_airport VARCHAR, to_airport VARCHAR)
"""
prompt = f"""### Instruction:
{question}
### Input:
{schema}
### Response:
"""
# 3. 추론 실행
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256, do_sample=False, num_beams=1)
generated_sql = tokenizer.decode(outputs[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True).strip()
print(generated_sql)
# 모델 출력 (정답):
# SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
30,000개의 홀드아웃(hold-out) 데이터셋에 대한 비실행(non-executing) 평가 결과입니다.
| Metric | Qwen/Qwen2.5-Coder-7B-Instruct | CypressTree-1.0-7B | Improvement (Δ) |
|---|---|---|---|
| BLEU | 5.8701 | 86.2469 | +80.38 |
| chrF | 11.2665 | 90.1089 | +78.84 |
| ROUGE-L | 0.1634 | 0.9271 | +0.76 |
| Token-F1 | 0.1087 | 0.9237 | +0.82 |
| Syntactic-Validity | 0.8745 | 0.9977 | +0.12 |
daje/kotext-to-sql-v1 (200,000 samples)@misc{namuai-x-2025-cypresstree,
title={CypressTree-1.0-7B: A Specialized Language Model for Korean Text-to-SQL},
author={namuai-x},
year={2025},
url={[https://huggingface.co/namuai-x/CypressTree-1.0-7B](https://huggingface.co/namuai-x/CypressTree-1.0-7B)}
}
Apache 2.0 license.
CypressTree-1.0-7B is a 7B parameter language model specialized for converting natural language queries in Korean to SQL. It is designed to deeply understand complex database schemas and the intent of Korean questions to generate accurate and efficient SQL queries.
Based on Alibaba's Qwen2 architecture, its Korean SQL generation capabilities were advanced using the daje/kotext-to-sql-v1 dataset.
Key Features:
JOINs, subqueries, and compound WHERE conditions.import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
# 1. Load the model and tokenizer
model_id = "namuai-x/CypressTree-1.0-7B"
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
# 2. Construct the prompt (Example with complex Multi-JOIN)
question = "보스턴에서 샌프란시스코로 비행하는 항공사는 어떤 것들이 있나요?" # "Which airlines fly from Boston to San Francisco?"
schema = """
CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT);
CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR);
CREATE TABLE city (city_code VARCHAR, city_name VARCHAR);
CREATE TABLE flight (airline_code VARCHAR, from_airport VARCHAR, to_airport VARCHAR)
"""
prompt = f"""### Instruction:
{question}
### Input:
{schema}
### Response:
"""
# 3. Run inference
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256, do_sample=False, num_beams=1)
generated_sql = tokenizer.decode(outputs[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True).strip()
print(generated_sql)
# Model Output (Correct):
# SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
Non-executing evaluation results on a 30,000-sample hold-out set.
| Metric | Qwen/Qwen2.5-Coder-7B-Instruct | CypressTree-1.0-7B | Improvement (Δ) |
|---|---|---|---|
| BLEU | 5.8701 | 86.2469 | +80.38 |
| chrF | 11.2665 | 90.1089 | +78.84 |
| ROUGE-L | 0.1634 | 0.9271 | +0.76 |
| Token-F1 | 0.1087 | 0.9237 | +0.82 |
| Syntactic-Validity | 0.8745 | 0.9977 | +0.12 |
daje/kotext-to-sql-v1 (200,000 samples)@misc{namuai-x-2025-cypresstree,
title={CypressTree-1.0-7B: A Specialized Language Model for Korean Text-to-SQL},
author={namuai-x},
year={2025},
url={[https://huggingface.co/namuai-x/CypressTree-1.0-7B](https://huggingface.co/namuai-x/CypressTree-1.0-7B)}
}
Apache 2.0 license.