Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More documentation refactoring #477

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
107 changes: 53 additions & 54 deletions tripy/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# Tripy: A Python Programming Model For TensorRT

[**Installation**](#installation)
| [**Getting Started**](#getting-started)
[**Quick Start**](#quick-start)
| [**Installation**](#installation)
| [**Examples**](https://github.com/NVIDIA/TensorRT-Incubator/tree/main/tripy/examples)
| [**Notebooks**](https://github.com/NVIDIA/TensorRT-Incubator/tree/main/tripy/notebooks)
| [**Contributing**](https://github.com/NVIDIA/TensorRT-Incubator/blob/main/tripy/CONTRIBUTING.md)
Expand All @@ -17,53 +17,63 @@ a deep learning inference compiler.

What you can expect:

- **High Performance:** Leveraging [TensorRT](https://developer.nvidia.com/tensorrt)'s optimization capabilties.
- **High performance** by leveraging [TensorRT](https://developer.nvidia.com/tensorrt)'s optimization capabilties.
- An **intuitive API** that follows conventions of the ecosystem.
- **Debuggability** with features like **eager mode** to interactively debug mistakes.
- **Excellent error messages** that are informative and actionable.
- **Friendly documentation** that is comprehensive but concise, with code examples.

- **Intuitive API:** A familiar API that follows conventions of the ecosystem.

- **Debuggability:** **Eager mode** to interactively debug mistakes.
## Quick Start

- **Excellent Error Messages**: Informative and actionable.
See the
[Introduction To Tripy](https://nvidia.github.io/TensorRT-Incubator/pre0_user_guides/00-introduction-to-tripy.html)
guide for details:

- **Friendly Documentation**: Comprehensive but concise, with code examples.
<!-- Tripy: DOC: NO_PRINT_LOCALS Start -->
- **Defining** a model:

Code is worth 1,000 words:
```py
class Model(tp.Module):
def __init__(self):
self.conv = tp.Conv(in_channels=1, out_channels=1, kernel_dims=[3, 3])

<!-- Tripy: DOC: NO_PRINT_LOCALS Start -->
```py
# Define our model:
class Model(tp.Module):
def __init__(self):
self.conv = tp.Conv(in_channels=1, out_channels=1, kernel_dims=[3, 3])

def __call__(self, x):
x = self.conv(x)
x = tp.relu(x)
return x


# Initialize the model and load weights:
model = Model()
model.load_state_dict(
{
"conv.weight": tp.ones((1, 1, 3, 3)),
"conv.bias": tp.ones((1,)),
}
)

inp = tp.ones((1, 1, 4, 4))

# Eager mode:
eager_out = model(inp)

# Compiled mode:
compiled_model = tp.compile(
model,
args=[tp.InputInfo(shape=(1, 1, 4, 4), dtype=tp.float32)],
)

compiled_out = compiled_model(inp)
```
def __call__(self, x):
x = self.conv(x)
x = tp.relu(x)
return x
```

- **Initializing** it:

```py
model = Model()
model.load_state_dict(
{
"conv.weight": tp.ones((1, 1, 3, 3)),
"conv.bias": tp.ones((1,)),
}
)

dummy_input = tp.ones((1, 1, 4, 4))
```

- Executing in **eager mode**:

```py
eager_out = model(dummy_input)
```

- **Compiling** and executing:

```py
compiled_model = tp.compile(
model,
args=[tp.InputInfo(shape=(1, 1, 4, 4), dtype=tp.float32)],
)

compiled_out = compiled_model(dummy_input)
```
<!-- Tripy: DOC: NO_PRINT_LOCALS End -->


Expand Down Expand Up @@ -106,14 +116,3 @@ For the latest changes, build Tripy wheels from source:
python3 -c "import nvtripy as tp; x = tp.ones((5,), dtype=tp.int32); assert x.tolist() == [1] * 5"
```
<!-- Tripy: DOC: OMIT End -->


## Getting Started

- **Start with**:
[Introduction To Tripy](https://nvidia.github.io/TensorRT-Incubator/pre0_user_guides/00-introduction-to-tripy.html)

Other guides:

- [Compiling For Better Performance](https://nvidia.github.io/TensorRT-Incubator/pre0_user_guides/02-compiler.html)
- [Quantization](https://nvidia.github.io/TensorRT-Incubator/pre0_user_guides/01-quantization.html)
Loading