Hi, I am trying to make a first contribution to Catalyst, in test_template.py in frontend.
I am following the installing guide of catalyst.
I am running in the directory catalyst. I am not sure if I am running the commands in the correct directory.
I created a python virtual environment.
I executed: pip install -r requirements.txt
And: git submodule update --unit --depth=1
But when I execute make test-frontend, I get the following error:
check the Catalyst lit test suite
cmake --build /home/nick-test/Documents/catalyst//mlir/build --target check-frontend
Error: /home/nick-test/Documents/catalyst/mlir/build is not a directory
make: *** [Makefile:71: lit] Error 1
Then I create the build directory.
When I execute make test-frontend again, I get the following error:
check the Catalyst lit test suite
cmake --build /home/nick-test/Documents/catalyst//mlir/build --target check-frontend
Error: could not load cache
make: *** [Makefile:71: lit] Error 1
Hello @ndcroos ! For contributing to Catalyst I would suggest you to install the project from source: Installation β Catalyst 0.2.2-dev documentation You will need to run make all first and then it will populate the mlir build folder. After that you should be able to run make test-frontend
Thanks @Romain_Moyard and @josh for answering. However, it seems like I also have to solve another issue with the cmake version, before I can continue.
But meanwhile, I can use the CI for running tests. Thanks for the suggestion.
I tried @Romain_Moyardβs suggestions. I was able to run make all.
When I run make test-frontend, test_autograph.py fails because of ModuleNotFoundError: No module named 'tensorflow' tensorflow needs to be added to requirements.txt. There is another open PR about this issue:
After running pip install tensorflow, I run make test-frontend, but I get this error:
[0/1] Run the frontend tests
FAIL: Frontend Tests :: test_autograph.py (16 of 16)
******************** TEST 'Frontend Tests :: test_autograph.py' FAILED ********************
Script:
--
: 'RUN: at line 17'; /home/nick-test/Documents/venv_catalyst/bin/python3 /home/nick-test/Documents/catalyst/frontend/test/lit/test_autograph.py | FileCheck /home/nick-test/Documents/catalyst/frontend/test/lit/test_autograph.py
--
Exit Code: 1
Command Output (stderr):
--
2023-08-31 18:08:46.149415: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
/home/nick-test/Documents/catalyst/frontend/test/lit/test_autograph.py:253:11: error: CHECK: expected string not found in input
# CHECK: (y, z) = (0, False)
^
<stdin>:135:24: note: scanning from here
def if_assign_multiple(x: float):
^
<stdin>:138:2: note: possible intended match here
y, z = (0, False)
^
Input file: <stdin>
Check file: /home/nick-test/Documents/catalyst/frontend/test/lit/test_autograph.py
-dump-input=help explains the following input dump.
Input was:
<<<<<<
.
.
.
130:
131: Conditional requires consistent return types across all branches, got:
132: - Branch at index 0: [ShapedArray(float64[], weak_type=True)]
133: - Branch at index 1: [ShapedArray(int64[], weak_type=True)]
134: Please specify an else branch if none was specified.
135: def if_assign_multiple(x: float):
check:253'0 X~~~~~~~~~~~ error: no match found
136: """Test a conditional that assigns to multiple existing variables."""
check:253'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137: with ag__.FunctionScope('if_assign_multiple', 'fscope', ag__.ConversionOptions(recursive=True, user_requested=True, optional_features=(), internal_convert_user_code=True)) as fscope:
check:253'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138: y, z = (0, False)
check:253'0 ~~~~~~~~~~~~~~~~~~~
check:253'1 ? possible intended match
139:
check:253'0 ~
140: def get_state():
check:253'0 ~~~~~~~~~~~~~~~~~~
141: return (y, z)
check:253'0 ~~~~~~~~~~~~~~~
142:
check:253'0 ~
143: def set_state(vars_):
check:253'0 ~~~~~~~~~~~~~~~~~~~~~~~
.
.
.
>>>>>>
--
********************
********************
Failed Tests (1):
Frontend Tests :: test_autograph.py
Testing Time: 131.58s
Passed: 15
Failed: 1
Thanks @ndcroos for your feedback, I think there might be an issue with tensorflow version. Could you share what version was installed? (On the CI tests we install python3 -m pip install tensorflow-cpu which is currently 2.13.0).
We will update the test suite to skip the test if TF is not installed. In the meantime you should not worry about this issue as the CI tests should run without an issue.
Thanks for reaching out and let me know if it helps
Hi @ndcroos , is the issue persisting? There is probably some version mismatch that removes the parenthesis but it should not be a blocker for your PR. Can you share your full environment?
Hi, I havenβt found the time to further on this, but I did run the tests again now, to see what the results are.
I work on a Debian 12 system. I just fetched the updates upstream and merged with my local repository. I did pip install -r requirements.txt again. pip list gives this (I installed tensorflow instead of tensorflow-cpu:
I am not sure if I need to run make runtime again. It takes quite some time on my system. I did not run it this time, but I did run make test-frontend. The text output gives errors relating to a wrong version of jaxlib.
Command Output (stderr):
--
/home/nick-test/Documents/catalyst/frontend/catalyst/__init__.py:29: UserWarning: Catalyst detected a version mismatch for the installed 'jaxlib' package. Please make sure to install the exact version required by Catalyst to avoid undefined behaviour.
Expected: 0.4.14 Found: 0.4.13
Hi @ndcroos , we just released a new version of Catalyst and it requires a new version of Jax. Unfortunately you have to git submodule update and after that you need to rebuild Catalyst with make all. The last step will take some time.