You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/2.User-guide/2.How-use-web.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,9 @@ After setting the parameters of the model, click the `Train` button at the botto
22
22
23
23
After the training is completed, the model will be saved (if the user chooses to save the model in the settings) to the DarwinKit model directory (default is `~/.cache/DarwinKit`, which can be modified by changing the `DSPIKE_HOME` environment variable). Then users can use the model for prediction on the prediction page or view the training logs and parameters of the model on the visualization page.
24
24
25
+
#### Resume Training
26
+
If users need to resume training based on the weights of a previously trained model, they only need to select the previously trained model in the `Resume` dropdown box on the training page, and then click the `Train` button to continue training from the last checkpoint.
27
+
25
28
### Predict Models
26
29
Users can use trained models for prediction. On the prediction page, users can select a trained model, then input text, and click the predict button to get the prediction result of the model.
27
30
@@ -30,11 +33,21 @@ All trained models will be displayed in the `Model Name` dropdown box, and users
30
33
31
34
After starting the prediction, the output of the model will be displayed on the page in real-time.
32
35
36
+
### Model Forking
37
+
The model forking feature provides developers with a new way to customize models. By using the `Fork` operation, you can create a forked version based on an existing model and edit, manage, and train it. Users select an existing model to `Fork`, creating a new forked model that ensures all subsequent operations are independent of the original model, protecting the integrity and security of the original model.
38
+
39
+
**User Guide**
40
+
1. On the train models page, select a model and set the relevant parameters. Click the Fork button, enter the name of the forked model in the pop-up box, and click Create fork in the pop-up box to create the forked model.
41
+

42
+
2. After creating the forked model, it will automatically jump to the model editing page. The introduction of the editing page is as follows.
43
+

44
+
3. After editing, click the fork in the sidebar to enter the management page of the forked model. In the Forked Model dropdown box, you can select the forked model. After selecting the model, you can click the `View & Edit` button to enter the editing page of the forked model, or click the `Train` button to train the model.
45
+

46
+
33
47
### Model Visualization
34
48
Users can view the training logs and parameters of trained models. On the visualization page, users can select trained models (multiple models can be selected for data comparison), and click the view button to see the visualized charts of the parameters.
35
49
36
50
The schematic diagram is as follows:
37
51

38
52
39
-
If the model is in training, the page will update the data in real-time.
40
-
53
+
If the model is in training, the page will update the data in real-time.
The `TrainerConfig` class is used to configure the training parameters. Specific parameters can be referenced in the definition of the `TrainerConfig` class.
68
68
@@ -71,13 +71,13 @@ The `TrainerConfig` class is used to configure the training parameters. Specific
71
71
### Saving and Loading the Model
72
72
During model training, the logic for saving the model is generally controlled according to the settings in `TrainerConfig`. For example, in the `TrainerConfig` of `SpikeGPT`, we can set `save_step_interval` to control the interval for saving the model.
73
73
74
-
The path for saving the model is determined based on the values of `tconf.name` and the `DSPIKE_HOME` environment variable.
74
+
The path for saving the model is determined based on the values of `tconf.name` and the `DARWIN_KIT_HOME` environment variable.
75
75
76
76
### Generating Text
77
77
After training is complete, the trained model can be loaded using the model name set during training. We can use the following code to generate text:
78
78
79
79
```python
80
-
from darkit import Predicter
80
+
from darkit.lm.mainimport Predicter
81
81
predicter = Predicter.from_pretrained(model_name)
82
82
83
83
prompt ="I am"
@@ -93,3 +93,48 @@ We can use the `predict` method to generate text. The `predict` method accepts a
93
93
The schematic diagram is as follows:
94
94
95
95

96
+
97
+
## Complete Code
98
+
```python
99
+
from datasets import load_dataset
100
+
from transformers import AutoTokenizer, GPT2Tokenizer
101
+
from darkit.lm.main import Trainer, Predicter
102
+
from darkit.lm.models.SpikeGPT import SpikeGPT, SpikeGPTConfig, TrainerConfig
0 commit comments