-
Notifications
You must be signed in to change notification settings - Fork 5
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
Documentation for verify() #960
base: main
Are you sure you want to change the base?
Conversation
eac11ce
to
bab1353
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for adding the docs!
ps. please update the PR title
docs/src/SUMMARY.md
Outdated
@@ -7,6 +7,7 @@ | |||
# Project setup | |||
- [Building](./build.md) | |||
- [Testing](./test.md) | |||
- [Verification](./verification.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo this should be in the dev notes section, something like Verification in tests
docs/src/verification.md
Outdated
def test_add(): | ||
|
||
class Add(nn.Module): | ||
def __init__(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix indent (4 spaces)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for some reason github renders it to 8 spaces, even though it's 4 spaces for me locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should use spaces, not tabs
docs/src/verification.md
Outdated
<br/> | ||
<br/> | ||
|
||
<img src="imgs/checkers/checkers.svg" alt="Checkers" style="width: 1200%;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's see what others say, but to me the picture doesn't add much value and makes the doc harder to edit/update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nvukobratTT what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with using images and they can be really useful as part of documentaion. However, it's important that those can be edit/updated over time.
That said, I would opt out for using ExcallyDraw to create this and similar diagrams, and next to the image also store exported ED file which we can load and edit in the future.
docs/src/verification.md
Outdated
| Feature | Enabled (default) | | ||
|-----------------------------------|:-----------------:| | ||
| Verification as a method | `True` | | ||
| Output size check | `True` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the output size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed table a bit, hopefully it's clearer now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the output length? 😄 is it the number of output tensors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hahah yes (I will put number of output tensors instead)
e8e5897
to
6dd3150
Compare
0301a80
to
4966a68
Compare
docs/src/verification.md
Outdated
|
||
## General Overview | ||
|
||
When comparing our `compiled_model` with the `framework_model` (e.g., `PyTorch`), we aim to verify whether the output from the `compiled_model` is sufficiently similar to the output from the `framework_model` (where required degree of similarity is configurable). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the introduction section, let's use common language instead of code-specific names (e.g. instead of compiled_model
, let's use compiled model).
Using code-specific names is beneficial below examples. In other case, I would more prefer to have common language :))
docs/src/verification.md
Outdated
|
||
## General Overview | ||
|
||
When comparing our `compiled_model` with the `framework_model` (e.g., `PyTorch`), we aim to verify whether the output from the `compiled_model` is sufficiently similar to the output from the `framework_model` (where required degree of similarity is configurable). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also mention what the framework model is. E.g. model that is run on host/cpu.
docs/src/verification.md
Outdated
2. Run a forward pass through the framework model | ||
3. Compile the framework model using `Forge` | ||
4. Run a forward pass through the compiled model | ||
5. Compare the outputs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit picking, but let's put .
on every point, or remove it :))
docs/src/verification.md
Outdated
|-----------------------------------|---------------------|:-----------------:| | ||
| Verification as a method | `enabled` | `True` | | ||
| Number of output tensors check | `verify_size` | `True` | | ||
| Output type check | `verify_dtype` | `True` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be more precise. E.g. output data format/type check
docs/src/verification.md
Outdated
For more information about `VerifyConfig` you can check `forge/forge/verify/config.py`. | ||
|
||
**Example of usage** | ||
```python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can keep following examples a bit shorter. E.g. now that we have full example above, we can do something like this:
...
fw_out = framework_model(*inputs)
co_out = compiled_model(*inputs)
verify(inputs, framework_model, compiled_model, VerifyConfig(verify_dtype=False))
4966a68
to
6296c29
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Added documentation for the
verify()
function andVerifyConfig
class. This includes an overview of verification steps, examples of usage, and details on configurable checkers such asAutomaticValueChecker
,AllCloseValueChecker
andFullValueChecker
. Additionally, provided information for enabling/disabling verification features through theVerifyConfig
.