Skip to content
Merged
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<!-- simple introduction -->

- **Docs**: https://docs.torchmeter.top ([Backup link](https://torchmeter.github.io/latest) πŸ”—)
- **Intro**: Provides comprehensive measurement of Pytorch model's `Parameters`, `FLOPs/MACs`, `Memory-Cost`, `Inference-Time` and `Throughput` with highly customizable result display ✨
- **Intro**: Provides comprehensive measurement of Pytorch model's `Parameters`, `FLOPs/MACs`, `Memory-Cost`, `Inference-Time` and `Throughput` with **highly customizable result display** ✨

## π’œ. π»π’Ύπ‘”π’½π“π’Ύπ‘”π’½π“‰π“ˆ

Expand Down Expand Up @@ -381,7 +381,7 @@ Before jumping in, let's ensure smooth collaboration by reviewing our πŸ“‹ [**co

- `TorchMeter` is an open-source project shared by developers worldwide. We're committed to fostering a **friendly, safe, and inclusive** environment for all participants.

- The provisions stipulated in our [Code - of - Conduct file](CODE_OF_CONDUCT.md) are applicable to all community platforms, which include, but are not limited to, GitHub repositories, community forums, and similar ones.
- The provisions stipulated in our [Code-of-Conduct file](CODE_OF_CONDUCT.md) are applicable to all community platforms, which include, but are not limited to, GitHub repositories, community forums, and similar ones.

## β„±. πΏπ’Ύπ’Έπ‘’π“ƒπ“ˆπ‘’

Expand Down
26 changes: 14 additions & 12 deletions docs/src/en/cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ hide:

As the name implies, it is the hierarchical index of a operation tree.

Actually, the level index of a tree node equals to `len(tree_node.node_id.split('.'))`
Figuratively, within the model operation tree, ^^each guide line represents a level^^. The level index value commences from **0** and increments from left to right.

Additionally, the level index at which a tree node is mounted is equal to `len(tree_node.node_id.split('.'))`. For instance, the node `(1.1.6.2) 1 BatchNorm2d` below is mounted at level 4.

```title="" linenums="0"
AnyNet
Expand All @@ -54,19 +56,19 @@ AnyNet

↑ ↑ ↑ ↑

0 1 2 3
0 1 2 3 (level index, each pointing to a guide line)
```

### **:material-numeric-3-box: How to use the tree level index?**

A valid level index empowers you to customize the operation tree with meticulous precision.
`torchmeter` regards the following value as a valid tree level index:

1. A non-negative integer (e.g. `0`, `1`, `2`, ...): The configurations under a specific index apply only to the corresponding level.
2. `default`: The configurations under this index will be applied to all undefined levels.
3. `all`: The configurations under this index will be applied to all levels.
1. **A non-negative integer (e.g. `0`, `1`, `2`, ...)**: The configurations under a specific index apply only to the corresponding level.
2. **`default`**: The configurations under this index will be applied to all undefined levels.
3. **`all`**: The configurations under this index will be applied to all levels.

Please refer to [Customize the Hierarchical Display](demo.ipynb##fb1-customize-the-hierarchical-display){ .md-button } for specific usage scenarios.
Please refer to [Customize the Hierarchical Display](https://docs.torchmeter.top/latest/demo/#fb1-customize-the-hierarchical-display){ .md-button } for specific usage scenarios.

---

Expand Down Expand Up @@ -202,7 +204,7 @@ All the attributes that are available, as defined below, are intended to:
| `operation` | `torch.nn.Module` | The underlying pytorch module |
| `type` | `str` | The operation type. If the operation is a pytorch module, use the name of its class |
| `name` | `str` | The module name defined in the underlying pytorch model |
| `node_id` | `str` | A globally unique module identifier, <br>formatted as `<parent-node-identifier>.<current-level-index>`. <br>The index commences from `1`, cause the root is denoted as `0` |
| `node_id` | `str` | A globally unique module identifier, <br>formatted as `<parent-node-id>.<node-number-in-current-level>`. <br>The index commences from `1`, cause the root is denoted as `0` |
| `is_leaf` | `bool` | Whether the node is a leaf node (no child nodes) |
| `module_repr` | `str` | The text representation of the current operation. <br>For non-leaf nodes, it's the ndoe type. <br>Conversely, it is the return of `__repr__()` method |
| `parent` | `torchmeter.engine.OperationNode` | The parent node of this node. Each node has only one parent |
Expand Down Expand Up @@ -238,7 +240,7 @@ There are four types of units in `torchmeter`, listed as follows:

!!! note ""

The `raw-data` tag in the subsequent content indicates that the unit marked with this tag is used in the `raw data` mode
The `raw-data` tag in the subsequent content indicates that the unit marked with this tag is used in the [`raw data` mode :material-link-variant:](https://docs.torchmeter.top/latest/demo/#i1-raw-data-mode)

=== ":material-counter: Counting Units"

Expand Down Expand Up @@ -284,7 +286,7 @@ There are four types of units in `torchmeter`, listed as follows:
| unit | explanation | tag | example |
|:------:|:----------------:|:----------:|:------------------------------------------------------- |
| `IPS` | Input Per Second | `raw-data` | `5 IPS`: process `5` inputs per second |
| `KIPS` | $10^3$ IPS | | `5 KIPS`: process `5,000` inputs per second |
| `MIPS` | $10^6$ IPS | | `5 MIPS`: process `5,000,000` inputs per second |
| `GIPS` | $10^9$ IPS | | `5 GIPS`: process `5,000,000,000` inputs per second |
| `TIPS` | $10^{12}$ IPS | | `5 TIPS`: process `5,000,000,000,000` inputs per second |
| `KIPS` | $10^3$ `IPS` | | `5 KIPS`: process `5,000` inputs per second |
| `MIPS` | $10^6$ `IPS` | | `5 MIPS`: process `5,000,000` inputs per second |
| `GIPS` | $10^9$ `IPS` | | `5 GIPS`: process `5,000,000,000` inputs per second |
| `TIPS` | $10^{12}$ `IPS` | | `5 TIPS`: process `5,000,000,000,000` inputs per second |
16 changes: 9 additions & 7 deletions docs/src/en/contribute/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,17 +310,19 @@ Clear commit message helps us:

### **Structure**

```title="" linenums="0"
<type>[optional scope][optional !]: <subject>
```bash title="" linenums="0"
<type>[optional scope][optional !]: <subject> # (1)
```

1. Note: there is **one space** between the `:` and the subject❗️

??? abstract "Type Prefixes"

> Most are the same as [Commit Message Type Prefixes :material-link-variant:](#Structure_1){ data-preview }, cause the PR will finally be merged as a commit.

!!! danger "Limitations"

Type prefix **must be one** in the following table, otherwise the PR will be rejected!
Type prefix **must be one** in the following table, otherwise the PR will be **rejected**!

| PR Type | When to Use | Example |
|:----------:|:---------------------------:|:--------------------------:|
Expand Down Expand Up @@ -359,12 +361,12 @@ Clear commit message helps us:

# πŸ‘Ž Avoid
fix( ): Memory leak
fix( core): memory leak
fix( core): Memory leak
```

??? warning "Exclamation Mark (`!`, Optional)"

A `!` indicates a breaking change, which means that the PR will {++bring a major version bump++}. Therefore, please use it with caution. The PRs denoted by `!` will undergo a more rigorous review procedure.
A `!` indicates a **breaking change**, which means that the PR will {++bring a major version bump++}. Therefore, please use it ^^with caution^^. The PRs denoted by `!` will ^^undergo a more rigorous review procedure^^.

??? abstract "Subject"

Expand All @@ -378,10 +380,10 @@ Clear commit message helps us:

```title="" linenums="0"
# πŸ‘ Good
fix: memory leak described in #456
fix: Memory leak described in #456

# πŸ‘Ž Avoid
fix: #456 memory leak
fix: #456 Memory leak
```

---
Expand Down
2 changes: 1 addition & 1 deletion docs/src/en/contribute/discussions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Discussions
???+ note

<figure markdown>
![TorchMeter Discussions](../assets/contribute/discussion_tab.png)
![TorchMeter Discussions](../assets/contribute/discussion_tab.png){ loading=lazy }
<figcaption>[Access to `Discussions` :material-link-variant:](https://github.com/TorchMeter/torchmeter/discussions)</figcaption>
</figure>

Expand Down
4 changes: 2 additions & 2 deletions docs/src/en/contribute/issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Issues
???+ note

<figure markdown>
![TorchMeter Issues](../assets/contribute/issue_tab.png)
![TorchMeter Issues](../assets/contribute/issue_tab.png){ loading=lazy }
<figcaption>[Access to `Issues` :material-link-variant:](https://github.com/TorchMeter/torchmeter/issues)</figcaption>
</figure>

Expand Down Expand Up @@ -39,7 +39,7 @@ title: Issues

??? example "Illustration of filing an issue"

![Illustration of filing an issue](../assets/contribute/create_issue_from_template.png)
![Illustration of filing an issue](../assets/contribute/create_issue_from_template.png){ loading=lazy }

- Further reading: [How maintainers manage issues :material-link-variant:](../others/management.md#Issue-Management){ data-preview }

Expand Down
4 changes: 2 additions & 2 deletions docs/src/en/contribute/prs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Pull Requests (PRs)
???+ note

<figure markdown>
![TorchMeter Pull Requests](../assets/contribute/pr_tab.png)
![TorchMeter Pull Requests](../assets/contribute/pr_tab.png){ loading=lazy }
<figcaption>[Access to `Pull Requests(PRs)` :material-link-variant:](https://github.com/TorchMeter/torchmeter/pulls)</figcaption>
</figure>

Expand Down Expand Up @@ -129,7 +129,7 @@ A successful installation will display the `Git` version (e.g., `git version 2.4

??? example "Illustration of forking torchmeter"

![Fork TorchMeter](../assets/contribute/fork_torchmeter.png)
![Fork TorchMeter](../assets/contribute/fork_torchmeter.png){ loading=lazy }

---

Expand Down
4 changes: 3 additions & 1 deletion docs/src/en/contribute/welcome_contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ Whether you're:

Your input is pretty valuable to our community!

Before jumping in, let's ensure smooth collaboration by reviewing these guidelines first. They'll help us keep things organized and make your contribution process as efficient as possible!
Before jumping in, let's ensure smooth collaboration by reviewing these guidelines first πŸ‘†.

They'll help us keep things organized and make your contribution process as efficient as possible!
4 changes: 2 additions & 2 deletions docs/src/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ hide:
2. Install locally:

```bash title="" linenums="0"
pip install torchmeter-x.x.x.whl # (1)
pip install torchmeter-x.x.x-py3-none-any.whl # (1)
```

1. πŸ™‹β€β™‚οΈ Replace `x.x.x` with actual version
Expand Down Expand Up @@ -342,7 +342,7 @@ Thanks again !

- `TorchMeter` is an open-source project built by developers worldwide. We're committed to fostering a **friendly, safe, and inclusive** environment for all participants.

- This code applies to all community spaces including but not limited to GitHub repositories, community forums, etc.
- The provisions stipulated in our [Code-of-Conduct file :material-link-variant:](https://github.com/TorchMeter/torchmeter/blob/master/CODE_OF_CONDUCT.md) are applicable to all community platforms, which include, but are not limited to, `GitHub` repositories, community forums, and similar ones.

## β„±. πΏπ’Ύπ’Έπ‘’π“ƒπ“ˆπ‘’

Expand Down
4 changes: 2 additions & 2 deletions docs/src/en/others/management.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To streamline collaboration and enable rapid iteration, `torchmeter` employs a s
| Branch Name | Name | Purpose | Maintainer | Contributor Permissions |
|:-----------:|:-------------:|:------------:|:-----------------:|:-- -------:|
| `master` | Primary Development Branch | Receives latest stable code, accepts new features, optimizations, and general bug fixes | All (with review) | **Allowed** to submit PRs |
| `vA.B.x` | Version Maintenance Branch | **Only accepts** bug fixes for this version, **no new features** | Core Team | **Forbidden** to submit PRs directly |
| `vA.B.x` | Version Maintenance Branch | **Only accepts** bug fixes for a minor version, **no new features** | Core Team | **Forbidden** to submit PRs directly |

#### **:material-numeric-1-box: Master Branch**

Expand All @@ -39,7 +39,7 @@ To streamline collaboration and enable rapid iteration, `torchmeter` employs a s
- **Purpose**: Exclusive bugfix channel for specific releases
- **Lifecycle**:
1. Created when incrementing major/minor versions
2. Archived when superseded by newer version branch (e.g., `v1.3.x`).
2. Archived when superseded by newer version branch (e.g., a new branch named `v1.3.x` will supersede `v1.2.x`).
- **Branch Protection Rules**: Inherits `master` branch's rules

[^1]: It should be noted that the `PATCH` number is represented by the letter `x`, which refers to a series of revisions to be updated in the future.
Expand Down
17 changes: 9 additions & 8 deletions examples/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2537,9 +2537,9 @@
"source": [
"#### F.b.1 Customize the Hierarchical Display\n",
"\n",
"> All customization fields can be found in the [`Default Configuration` section in `Cheatsheet` tab](cheatsheet.md##Default-Configuration).\n",
"> All customization fields can be found in the [`Default Configuration` section in `Cheatsheet` tab](https://docs.torchmeter.top/latest/cheatsheet/#Default-Configuration).\n",
"\n",
"You can customize the display of a tree level by designating the configurations through the level index, which can be found [here](./cheatsheet.md#Tree-Level-Index).\n"
"You can customize the display of a tree level by designating the configurations through the level index, which can be found [here](https://docs.torchmeter.top/latest/cheatsheet/#Tree-Level-Index).\n"
]
},
{
Expand Down Expand Up @@ -2857,7 +2857,7 @@
"source": [
"##### F.b.2.2 Customize the style\n",
"\n",
"> All customization fields can be found in the [`Customization` tab](cheatsheet.md)."
"> All customization fields can be found in the [`Cheatsheet` tab](https://docs.torchmeter.top/latest/cheatsheet/)."
]
},
{
Expand Down Expand Up @@ -3182,7 +3182,7 @@
"source": [
"###### F.b.2.3.2 Dynamic Text based on Tree Node Attributes\n",
"\n",
"A tree node represents an operation in the model, the attributes of which can be found in [`Tree Node Attributes` section in `Cheatsheet` tab](cheatsheet.md#Tree-Node-Attributes)."
"A tree node represents an operation in the model, the attributes of which can be found in [`Tree Node Attributes` section](https://docs.torchmeter.top/latest/cheatsheet/#Tree-Node-Attributes)."
]
},
{
Expand Down Expand Up @@ -3315,7 +3315,7 @@
"source": [
"#### F.c.1 Customize the Column/Overall Style\n",
"\n",
"> All customization fields can be found in the [`Default Configuration` section in `Cheatsheet` tab](cheatsheet.md##Default-Configuration)."
"> All customization fields can be found in the [`Default Configuration` section](https://docs.torchmeter.top/latest/cheatsheet/#Default-Configuration)."
]
},
{
Expand Down Expand Up @@ -5987,7 +5987,7 @@
"### H.e Restore Configuration\n",
"\n",
"> Mess up the configurations? Don't worry, we can restore them to the value in loaded file. \n",
"> If the config object is not created by loading a `yaml` file, will use the default value in [`Default Configuration`](cheatsheet.md##Default-Configuration) we've prepared for you."
"> If the config object is not created by loading a `yaml` file, will use the default value in [`Default Configuration`](https://docs.torchmeter.top/latest/cheatsheet/#Default-Configuration) we've prepared for you."
]
},
{
Expand Down Expand Up @@ -6189,12 +6189,12 @@
"### I.1 Raw Data Mode\n",
"\n",
"> When this mode is enabled, the statistic data will be represented in the unit at the time of statistics. \n",
"> For details, see [`Unit Explanation`](cheatsheet.md#Unit-Explanation)."
"> For details, see [`Unit Explanation`](https://docs.torchmeter.top/latest/cheatsheet/#Unit-Explanation)."
]
},
{
"cell_type": "code",
"execution_count": 105,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -6426,6 +6426,7 @@
"# --------------------------------------------------------------------------------\n",
"# model: Instance of `torchmeter.Meter` which acts like a decorator of your model\n",
"\n",
"# you can compare the result with that in `E.c.1` section\n",
"tb, data = model.profile(\"param\", no_tree=True, raw_data=True)"
]
},
Expand Down
Loading