Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-toml
- id: check-yaml
Expand All @@ -11,7 +11,7 @@ repos:
args: [--fix=lf]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.12.5
rev: v0.16.8
hooks:
# Run the linter.
- id: ruff
Expand All @@ -20,7 +20,7 @@ repos:
- id: ruff-format
args: ["--config=pyproject.toml"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.17.0 # Use the sha / tag you want to point at
rev: v2.3.1 # Use the sha / tag you want to point at
hooks:
- id: mypy
args: ["--install-types", "--non-interactive", "--ignore-missing-imports", "--check-untyped-defs",
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
import toydl
import importlib.metadata

print(importlib.metadata.version('toydl'))
print(importlib.metadata.version("toydl"))
```
12 changes: 5 additions & 7 deletions docs/quickstart/mlp.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
首先生成模拟数据,并将其分割为训练集和测试集:

```python
--8<-- "example/mlp_binary.py:gen_dateset"
--8 < --"example/mlp_binary.py:gen_dateset"
```

这里是一个简单的二维平面分割任务的数据:
Expand All @@ -19,9 +19,7 @@
## 配置网络结构

```python
mlp_config = MLPConfig(
in_size=2, out_size=1, hidden_layer_size=10, hidden_layer_num=2
)
mlp_config = MLPConfig(in_size=2, out_size=1, hidden_layer_size=10, hidden_layer_num=2)

mlp_model = MLPBinaryClassifyModel(mlp_config)
```
Expand Down Expand Up @@ -100,7 +98,7 @@ def run():
# 比较优化器性能
optimizer_results = {
"SGD": (sgd_training_loss, sgd_testing_loss, sgd_test_result),
"Momentum": (momentum_training_loss, momentum_testing_loss, momentum_result)
"Momentum": (momentum_training_loss, momentum_testing_loss, momentum_result),
}
plot_multiple_optimizers(optimizer_results, title="优化器性能对比")
```
Expand All @@ -115,13 +113,13 @@ def run():
## MLP完整训练步骤

```python
--8<-- "example/mlp_binary.py:model"
--8 < --"example/mlp_binary.py:model"
```

## 实验完整代码

??? note "本示例的完整代码: `example/mlp_binary.py`"

```python
--8<-- "example/mlp_binary.py"
--8 < --"example/mlp_binary.py"
```
Loading