Update README.md
Browse files
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
base_model: unsloth/
|
3 |
tags:
|
4 |
- text-generation-inference
|
5 |
- transformers
|
@@ -11,12 +11,82 @@ language:
|
|
11 |
- en
|
12 |
---
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
# Uploaded model
|
15 |
|
16 |
- **Developed by:** jackcwf
|
17 |
- **License:** apache-2.0
|
18 |
-
- **Finetuned from model :** unsloth/
|
|
|
|
|
19 |
|
20 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
21 |
|
22 |
-
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
1 |
---
|
2 |
+
base_model: unsloth/deepseek-r1-distill-llama-8b-unsloth-bnb-4bit
|
3 |
tags:
|
4 |
- text-generation-inference
|
5 |
- transformers
|
|
|
11 |
- en
|
12 |
---
|
13 |
|
14 |
+
# About Model
|
15 |
+
|
16 |
+
Fine-tuning is used to convert SQL language into natural language, making it easier for users to understand the business meaning of SQL queries. This fine-tuned model is based on the unsloth framework 和 uses the DeepSeek-R1-Distill-Llama-8B pre-trained model under unsloth.
|
17 |
+
|
18 |
+
|
19 |
+
# DataSet
|
20 |
+
|
21 |
+
[b-mc2/sql-create-context](https://huggingface.co/datasets/b-mc2/sql-create-context)
|
22 |
+
|
23 |
+
# Model train
|
24 |
+
|
25 |
+

|
26 |
+
|
27 |
+
1. **train/loss**: This chart shows the model's loss during training. As the training steps (global step) increase, the loss value drops sharply 和 then stabilizes, indicating that the model is gradually converging.
|
28 |
+
2. **train/learning_rate**: This chart shows how the learning rate changes over training steps. From the chart, we can see that the learning rate decreases as training progresses, which is likely part of a learning rate decay strategy to prevent the model from oscillating in the later stages of training.
|
29 |
+
3. **train/grad_norm**: This chart displays the change in gradient norm over training steps. The decrease in gradient norm suggests that the gradients are stabilizing, reducing instability during training.
|
30 |
+
4. **train/global_step**: This chart shows the increase in global training steps. As the training progresses, the step count gradually increases, indicating the progress of the training process.
|
31 |
+
5. **train/epoch**: This chart represents the progress of each training epoch. As the global steps increase, the epoch count also steadily grows.
|
32 |
+
|
33 |
+
|
34 |
+
# Inference results before 和 after model training:
|
35 |
+
|
36 |
+
## Prompt
|
37 |
+

|
38 |
+
|
39 |
+
## Define SQL query for testing
|
40 |
+
This is a complex customer analysis query used to test the understanding of the model
|
41 |
+
|
42 |
+
query1 = """
|
43 |
+
```sql
|
44 |
+
SELECT
|
45 |
+
c.customer_id,
|
46 |
+
c.name AS customer_name,
|
47 |
+
COUNT(o.order_id) AS total_orders,
|
48 |
+
SUM(o.total_amount) AS total_spent,
|
49 |
+
AVG(o.total_amount) AS avg_order_value,
|
50 |
+
MAX(o.order_date) AS last_order_date
|
51 |
+
FROM customers c
|
52 |
+
JOIN orders o ON c.customer_id = o.customer_id
|
53 |
+
LEFT JOIN order_items oi ON o.order_id = oi.order_id
|
54 |
+
WHERE o.order_date >= '2024-01-01'
|
55 |
+
GROUP BY c.customer_id, c.name
|
56 |
+
ORDER BY total_spent DESC
|
57 |
+
LIMIT 10;
|
58 |
+
```
|
59 |
+
Explain use case of this query.
|
60 |
+
"""
|
61 |
+
|
62 |
+
## Pre-training inference results:
|
63 |
+
|
64 |
+
The SQL query is designed to analyze customer data from the orders placed in January 2024. It aggregates information such as the number of orders, total spending, average order value, and the last order date for each customer. The results are sorted by total spending in descending order, allowing the identification of the top 10 customers based on their spending. This is useful for marketing or sales teams to target high-spending customers for promotions or personalized campaigns. The LEFT JOIN with order_items ensures that all customers, including those with pending or incomplete orders, are included in the results.<|end▁of▁sentence|>
|
65 |
+
|
66 |
+
## Inference results after training:
|
67 |
+
Show customer id, customer name, total orders, total spent, average order value,last order date for top 10 customers by total spent.< | end▁of▁sentence|>
|
68 |
+
|
69 |
+
|
70 |
+
# Model Download
|
71 |
+
|
72 |
+
| **Model** | **Base Model** | **下载** |
|
73 |
+
| -------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
74 |
+
| DeepSeek-R1-Distill-Llama-sql-8B | [Llama-3.1-8B](https://huggingface.co/meta-llama/Llama-3.1-8B) | [🤗 HuggingFace](https://huggingface.co/jackcwf/deepseek_sql_model/blob/main/unsloth.Q8_0.gguf) |
|
75 |
+
|
76 |
+
|
77 |
+
# Usage
|
78 |
+
|
79 |
+
If you are unsure how to use GGUF files, refer to one of [TheBloke's READMEs](https://huggingface.co/TheBloke/KafkaLM-70B-German-V0.1-GGUF) for more details, including on how to concatenate multi-part files.
|
80 |
+
|
81 |
+
|
82 |
# Uploaded model
|
83 |
|
84 |
- **Developed by:** jackcwf
|
85 |
- **License:** apache-2.0
|
86 |
+
- **Finetuned from model :** unsloth/deepseek-r1-distill-llama-8b-unsloth-bnb-4bit
|
87 |
+
|
88 |
+
|
89 |
|
90 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
91 |
|
92 |
+
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|