GrAITorchTests
contains integration tests
that allow to compare GrAIdient
models with their equivalent in PyTorch
.
The goal is to demonstrate a good level of reproducibility and
interoperability with PyTorch
.
These tests are run when branches are merged to the Release branches. Once a PR is "ready to review", please run these tests via the action trigger in GitHub .
These tests require a special Python
environment.
conda create --name graitorch python=3.9
conda activate graitorch
cd Tests/GrAITorchTests/Base
pip install -e .
Now, let us run the tests from Xcode or a bash
command:
swift test --filter GrAITorchTests
It is finally possible to clean the environment 🌍
conda deactivate
conda env remove --name graitorch
- Create a model in
GrAIdient
andPyTorch
. - Get the weigths from the
PyTorch
model and load them in theGrAIdient
model. - Load data from
PyTorch
and set it on both models. - Compute forward, apply dummy loss then the backward pass.
- Compare the gradient norm in the very first layer of both models.