cair / tmu

Implements the Tsetlin Machine, Coalesced Tsetlin Machine, Convolutional Tsetlin Machine, Regression Tsetlin Machine, and Weighted Tsetlin Machine, with support for continuous features, drop clause, Type III Feedback, focused negative sampling, multi-task classifier, autoencoder, literal budget, and one-vs-one multi-class classifier. TMU is written in Python with wrappers for C and CUDA-based clause evaluation and updating.
https://pypi.org/project/tmu/
MIT License
126 stars 13 forks source link

CUDA error when installing with non-local pip install #29

Closed olegranmo closed 1 year ago

olegranmo commented 1 year ago

This error does not occur with local install (pip3 install -e .), however, occurs with remote install (pip3 install tmu):

2023-04-17 06:40:30,320 - tmu.models.classification.vanilla_classifier - DEBUG - Initializing clause bank.... Traceback (most recent call last): File "./examples/experimental/classification/IMDbWordPredictionConvolutionDemo.py", line 125, in tm.fit(X_train, Y_train) File "/home/oleg/.local/lib/python3.8/site-packages/tmu/models/classification/vanilla_classifier.py", line 148, in fit self.init(X, Y) File "/home/oleg/.local/lib/python3.8/site-packages/tmu/models/classification/base_classification.py", line 32, in init self.init_clause_bank(X, Y) File "/home/oleg/.local/lib/python3.8/site-packages/tmu/models/classification/vanilla_classifier.py", line 126, in init_clause_bank self.clause_banks = [clause_bank_type(clause_bankargs) for in range(self.number_of_classes)] File "/home/oleg/.local/lib/python3.8/site-packages/tmu/models/classification/vanilla_classifier.py", line 126, in self.clause_banks = [clause_bank_type(clause_bankargs) for in range(self.number_of_classes)] File "/home/oleg/.local/lib/python3.8/site-packages/tmu/clause_bank/clause_bank_cuda.py", line 92, in init mod = load_cuda_kernel(parameters, "cuda/calculate_clause_outputs_predict.cu") File "/home/oleg/.local/lib/python3.8/site-packages/tmu/clause_bank/clause_bank_cuda.py", line 55, in load_cuda_kernel with path.open("r") as f: File "/usr/lib/python3.8/pathlib.py", line 1222, in open return io.open(self, mode, buffering, encoding, errors, newline, File "/usr/lib/python3.8/pathlib.py", line 1078, in _opener return self._accessor.open(self, flags, mode) FileNotFoundError: [Errno 2] No such file or directory: '/home/oleg/.local/lib/python3.8/site-packages/tmu/clause_bank/cuda/calculate_clause_outputs_predict.cu'

perara commented 1 year ago

Will investigate. I believe this is because the cuda kernels are not registered as assets during install, and is then simply omitted during install

olegranmo commented 1 year ago

Great :-)

perara commented 1 year ago

@olegranmo Could you try the following:

create a MANIFEST.in in the root directory with the following contents:

recursive-include tmu/clause_bank/cuda *.cu
  1. Inside setup.py, include the following argument include_package_data=True,

  2. pip install git+https://github.com/cair/tmu.git

olegranmo commented 1 year ago

Solved the problem - thanks!