File size: 7,183 Bytes
a00aaa5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
---
license: bsd-3-clause
language:
  - en
  - zh
base_model:
  - HuggingFaceTB/SmolLM3-3B
pipeline_tag: text-generation
tags:
  - HuggingFaceTB
  - SmolLM3-3B
---

# SmolLM3-3B-Int8

This version of SmolLM3-3B has been converted to run on the Axera NPU using **w8a16** quantization.

Compatible with Pulsar2 version: 4.1

## Convert tools links:

For those who are interested in model conversion, you can try to export axmodel through the original repo:
- https://huggingface.co/HuggingFaceTB/SmolLM3-3B

- [Github for SmolLM3-3B.axera](https://github.com/AXERA-TECH/SmolLM3-3B.axera)

- [Pulsar2 Link, How to Convert LLM from Huggingface to axmodel](https://pulsar2-docs.readthedocs.io/en/latest/appendix/build_llm.html)

## Support Platform
- AX650
  - [M4N-Dock(爱芯派Pro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)

## How to use

Download all files from this repository to the device.

**Using AX650 Board**

```bash
ai@ai-bj ~/yongqiang/push_hugging_face/SmolLM3-3B $ tree -L 1
.
├── config.json
├── infer_axmodel.py
├── README.md
├── smollm3_axmodel
├── smolvlm3_tokenizer
└── utils

3 directories, 3 files
```

#### Inference with AX650 Host, such as M4N-Dock(爱芯派Pro) or AX650N DEMO Board

input text:

```
帮我求解函数y=3x^2+1的导数.
```

log information(including the thinking process):

```bash
$ python3 infer_axmodel.py -q "帮我求解函数y=3x^2+1的导数." # 默认开启 think
...
Model loaded successfully!
slice_indices: [0, 1, 2]
Slice prefill done: 0
Slice prefill done: 1
Slice prefill done: 2
answer >> <think>
Okay, so I need to find the derivative of the function y = 3x² + 1. Hmm, let me think about how to approach this. I remember that when taking derivatives, we use the^@ power rule. The power rule says that if you have a function like x^n, its derivative is n*x^(n-1). Right? So, for each term in the function, I can apply this rule.

First, let's break down the function into its components. The function is 3x^@² + 1. The first term is 3x², and the second term is 1. The constant term 1 doesn't have an x in it, so when I take the derivative of 1, it should be 0 because the derivative of a constant is zero. That part seems straightforward^@.

Now, the main part is the term 3x². Here, the coefficient is 3, and the exponent is 2. Applying the power rule, the derivative of x² is 2x. But since there's a coefficient 3 in front of the x², I need to multiply^@ the derivative of the function by that coefficient. So, 3 times the derivative of x², which is 2x. That gives me 3*2x = 6x. So the derivative of 3x² is 6x.

Putting it all together, the derivative of the entire function^@ y = 3x² + 1 should be the derivative of 3x² plus the derivative of 1. The derivative of 3x² is 6x, and the derivative of 1 is 0. Therefore, the derivative of the whole function is 6x + 0,^@ which simplifies to 6x.

Wait, let me double-check that. If I have a function like 3x², the derivative is 6x. Let me verify that with the power rule. The power rule states that if you have a function f(x) = ax^n, then f'(^@x) = a*n*x^(n-1). In this case, a is 3 and n is 2. So f'(x) = 3*2*x^(2-1) = 6x. Yes, that's correct. So the derivative of 3x² is indeed ^@6x. And the derivative of the constant 1 is 0. So combining those, the derivative of the entire function is 6x. That seems right.

Is there anything else I need to consider here? Maybe I should check if there are any other terms or if I missed any steps. The original^@ function is a simple polynomial, so there shouldn't be any hidden complexities here. The power rule applies straightforwardly to each term. Since there are no other terms besides the 3x² and the constant, the process is complete.

Another way to think about it is to consider the limit definition of a derivative.^@ If I were to use the limit definition, the derivative of 3x² + 1 would be the limit as h approaches 0 of [ (3(x+h)² + 1) - (3x² + 1) ] / h. Simplifying that expression would lead me through the^@ same steps as before, but since I already applied the power rule, I can be confident that the result is correct.

Therefore, after going through the process step by step, I can be sure that the derivative of y = 3x² + 1 is indeed 6x. There's no mistake^@ in the calculation, and all the steps follow logically from the power rule. So the final answer is 6x.

Just to recap, the key steps were:

1. Identify the function: 3x² + 1.
2. Apply the power rule to each term.
3. For the term^@ 3x², the derivative is 3*2x^(2-1) = 6x.
4. For the term 1, the derivative is 0.
5. Combine the derivatives: 6x + 0 = 6x.

Yes, that all checks out. I^@ think that's thorough enough. I don't see any errors in this reasoning. Therefore, the derivative of the function y = 3x² + 1 is 6x.

**Final Answer**
The derivative of the function \( y = 3x^2 + 1 \) is \(\boxed{6x}\).
</think>
To find the derivative of the function \( y = 3x^2 + 1 \), we can use the power rule of differentiation. The power rule states that if we have a function of the form \( ax^n \), its derivative is \( a \cdot^@ n \cdot x^{n-1} \).

1. **Identify the terms in the function:**
   - The first term is \( 3x^2 \).
   - The second term is \( 1 \).

2. **Apply the power rule to each term:**
  ^@ - For the term \( 3x^2 \):
     - The coefficient \( a \) is 3.
     - The exponent \( n \) is 2.
     - The derivative is \( 3 \cdot 2 \cdot x^{2-1} = 6x \).
^@   - For the term \( 1 \):
     - The derivative of a constant is 0.

3. **Combine the results:**
   - The derivative of \( 3x^2 \) is \( 6x \).
   - The derivative of \( 1 \) is \( ^@0 \).

4. **Final result:**
   - The derivative of the entire function \( 3x^2 + 1 \) is \( 6x + 0 = 6x \).

Thus, the derivative of the function \( y = 3x^2 + 1^@ \) is \( 6x \).

\[
\boxed{6x}
\]
```

use the parameter `--disable-think` to disable the thinking process:

```sh
$ python3 infer_axmodel.py -q "帮我求解函数y=3x^2+1的导数." --disable-think

Model loaded successfully!
slice_indices: [0]
Slice prefill done: 0
answer >> 要求解函数 \( y = 3x^2 + 1 \) 的导数,我们可以使用导数的基本规则。

函数导数的导数可以通过导数的导数规则来求解。对于多项式^@函数,导数可以通过导数的导数规则来求解。对于函数 \( y = 3x^2 + 1 \),我们可以逐步求导:

1. **求导函数 \( y = 3x^2 \)**:
   根据导数的导^@数规则,导数规则中对于 \( x^n \) 的导数规则,导数规则为:
   \[
   \frac{d}{dx} (x^n) = n x^{n-1}
   \]
   在这里,\( n = 2^@ \),所以:
   \[
   \frac{d}{dx} (3x^2) = 3 \cdot \frac{d}{dx} (x^2) = 3 \cdot 2x^{2-1} = 6x
   \]

2. **求^@导数规则中的常数项**:
   对于常数项 \( 1 \),其导数为零,因为导数规则中常数项的导数为零:
   \[
   \frac{d}{dx} (1) = 0
   \]

将^@以上结果结合起来,我们得到:
\[
\frac{d}{dx} (y) = \frac{d}{dx} (3x^2 + 1) = 6x + 0 = 6x
\]

因此,函数 \( y = 3x^2 +^@ 1 \) 的导数为:
\[
\frac{dy}{dx} = 6x
\]

所以,求解函数 \( y = 3x^2 + 1 \) 的导数,我们得到:
\[
\frac{d}{dx} (3x^^@2 + 1) = 6x
\]

```