Views
No views yet
bnb_config = BitsAndBytesConfig(
load_in_4bit=use_4bit,
bnb_4bit_quant_type=bnb_4bit_quant_type,
bnb_4bit_compute_dtype=compute_dtype,
bnb_4bit_use_double_quant=use_nested_quant,model = AutoModelForCausalLM.from_pretrained(
model_name,
quantization_config=bnb_config,
device_map=device_map,
trust_remote_code=Truetokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
tokenizer.pad_token = tokenizer.eos_token
tokenizer.padding_side = "right"dataset = dataset.map(
lambda example: {
"input": "### Instruction: \nYou are a powerful text-to-SQL model. \
Your job is to answer questions about a database. You are given \
a question and context regarding one or more tables. \n\nYou must \
output the SQL query that answers the question. \
\n\n \
### Dialect:\n\nsqlite\n\n \
### question:\n\n"+ example["question"]+" \
\n\n### Context:\n\n"+example["context"],
"answer": example["answer"]
}
)output = model.generate(input["input_ids"])