Views
No views yet
1slices:
2 - sources:
3 - model: ajibawa-2023/Code-Llama-3-8B
4 layer_range: [0, 32]
5 - model: defog/llama-3-sqlcoder-8b
6 layer_range: [0, 32]
7merge_method: slerp
8base_model: ajibawa-2023/Code-Llama-3-8B
9parameters:
10 t:
11 - filter: self_attn
12 value: [0, 0.3, 0.5, 0.7, 0.5]
13 - filter: mlp
14 value: [0, 0.3, 0.5, 0.7, 0.5]
15 - value: 0.4 # fallback for rest of tensors
16dtype: bfloat161from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
2
3tokenizer = AutoTokenizer.from_pretrained("AdamLucek/llama3-8b-code-sql-slerp")
4model = AutoModelForCausalLM.from_pretrained(
5 "AdamLucek/llama3-8b-code-sql-slerp",
6 device_map="cuda",
7 quantization_config=BitsAndBytesConfig(load_in_8bit=True)
8)
9
10# Prepare the input text
11input_text = "Can you write a query to retrieve the names and email addresses of all customers who have made purchases totaling over $1000 in the last month from our 'sales' database?"
12input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
13
14# Generate the output
15outputs = model.generate(
16 **input_ids,
17 max_new_tokens=256,
18 pad_token_id=tokenizer.eos_token_id
19)
20
21# Decode and print the generated text
22print(tokenizer.decode(outputs[0], skip_special_tokens=True))\```sql
SELECT c.name, c.email
FROM customers c
JOIN sales s ON c.customer_id = s.customer_id
WHERE s.purchase_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH)
GROUP BY c.name, c.email
HAVING SUM(s.amount) > 1000;
\```
This query joins the 'customers' and'sales' tables on the 'customer_id' field, filters for sales made in the last month, groups the results by customer name and email, and then applies a condition to only include customers whose total purchase amount exceeds $1000. The result will be a list of names and email addresses for customers who have made purchases totaling over $1000 in the last month.