Matlib version error
System Info
uname -a
Linux laptop 6.8.0-47-generic #47-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 21:40:26 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
php -v
PHP 8.3.6 (cli) (built: Dec 2 2024 12:36:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans
dpkg -l | grep matlib
ii rindow-matlib 1.1.0-24.04 amd64 Rindow Math Matrix library
"codewithkyrian/transformers": "0.5.3"
PHP Version
8.3.6
Environment/Platform
- [x] Command-line application
- [ ] Web application
- [ ] Serverless
- [ ] Other (please specify)
Description
When trying to execute a simple summarization task, I get the following error:
PHP Fatal error: Uncaught LogicException: matlib 1.0.1 is an unsupported version. Supported versions are greater than or equal to 1.1.0 and less than 2.0.0. in /home/vinicius/Documentos/Palestras/transformers-php/projeto/vendor/rindow/rindow-matlib-ffi/src/MatlibFactory.php:127
Stack trace:
#0 /home/vinicius/Documentos/Palestras/transformers-php/projeto/vendor/rindow/rindow-matlib-ffi/src/MatlibFactory.php(56): Rindow\Matlib\FFI\MatlibFactory->assertVersion()
#1 /home/vinicius/Documentos/Palestras/transformers-php/projeto/vendor/codewithkyrian/transformers/src/Tensor/TensorService.php(23): Rindow\Matlib\FFI\MatlibFactory->__construct()
#2 /home/vinicius/Documentos/Palestras/transformers-php/projeto/vendor/rindow/rindow-math-matrix/src/Drivers/AbstractMatlibService.php(61): Codewithkyrian\Transformers\Tensor\TensorService->injectDefaultFactories()
#3 /home/vinicius/Documentos/Palestras/transformers-php/projeto/vendor/codewithkyrian/transformers/src/Tensor/Tensor.php(284): Rindow\Math\Matrix\Drivers\AbstractMatlibService->__construct()
#4 /home/vinicius/Documentos/Palestras/transformers-php/projeto/vendor/codewithkyrian/transformers/src/Tensor/Tensor.php(166): Codewithkyrian\Transformers\Tensor\Tensor::service()
#5 /home/vinicius/Documentos/Palestras/transformers-php/projeto/vendor/codewithkyrian/transformers/src/Tensor/Tensor.php(95): Codewithkyrian\Transformers\Tensor\Tensor::newBuffer()
#6 /home/vinicius/Documentos/Palestras/transformers-php/projeto/vendor/codewithkyrian/transformers/src/PretrainedTokenizers/PretrainedTokenizer.php(349): Codewithkyrian\Transformers\Tensor\Tensor->__construct()
#7 /home/vinicius/Documentos/Palestras/transformers-php/projeto/vendor/codewithkyrian/transformers/src/Pipelines/Text2TextGenerationPipeline.php(71): Codewithkyrian\Transformers\PretrainedTokenizers\PretrainedTokenizer->__invoke()
#8 /home/vinicius/Documentos/Palestras/transformers-php/projeto/resumo.php(35): Codewithkyrian\Transformers\Pipelines\Text2TextGenerationPipeline->__invoke()
#9 {main}
thrown in /home/vinicius/Documentos/Palestras/transformers-php/projeto/vendor/rindow/rindow-matlib-ffi/src/MatlibFactory.php on line 127
As it can be seen in the following screenshot, I have th 1.1.0 version:
Reproduction
<?php
use function Codewithkyrian\Transformers\Pipelines\pipeline;
require_once __DIR__ . '/vendor/autoload.php';
pipeline('summarization')('Test');
I have the same error when installing TransformersPHP in a Windows 11 pro environment in a Laravel project.
PHP version: 8.3.6 Laravel: 12.2.0 TransformersPHP: 0.5.2
Steps to reproduce:
- Follow documented installation using composer within a new Laravel project
- Pre-install model
- Attempt to run a method using the model in transformers
Error:
LogicException: matlib 1.0.1 is an unsupported version. Supported versions are greater than or equal to 1.1.0 and less than 2.0.0. in C:\laragon\www\awdai\vendor\rindow\rindow-matlib-ffi\src\MatlibFactory.php:127 Stack trace: #0 C:\laragon\www\awdai\vendor\rindow\rindow-matlib-ffi\src\MatlibFactory.php(56): Rindow\Matlib\FFI\MatlibFactory->assertVersion('matlib', '1.0.1', '1.1.0', '2.0.0') #1 C:\laragon\www\awdai\vendor\codewithkyrian\transformers\src\Tensor\TensorService.php(23): Rindow\Matlib\FFI\MatlibFactory->__construct('C:\laragon\www\...', Array) #2 C:\laragon\www\awdai\vendor\rindow\rindow-math-matrix\src\Drivers\AbstractMatlibService.php(61): Codewithkyrian\Transformers\Tensor\TensorService->injectDefaultFactories() #3 C:\laragon\www\awdai\vendor\codewithkyrian\transformers\src\Tensor\Tensor.php(284): Rindow\Math\Matrix\Drivers\AbstractMatlibService->__construct() #4 C:\laragon\www\awdai\vendor\codewithkyrian\transformers\src\Tensor\Tensor.php(166): Codewithkyrian\Transformers\Tensor\Tensor::service() #5 C:\laragon\www\awdai\vendor\codewithkyrian\transformers\src\Tensor\Tensor.php(386): Codewithkyrian\Transformers\Tensor\Tensor::newBuffer(3145728, 6) #6 C:\laragon\www\awdai\vendor\codewithkyrian\transformers\src\Utils\Image.php(567): Codewithkyrian\Transformers\Tensor\Tensor::fromString('\xD1\xCB\xBD\xD1\xCB\xBD\xD3\xCD\xBF\xD4\xCE\xC0\xD5\xCF\xC1...', 6, Array) #7 C:\laragon\www\awdai\vendor\codewithkyrian\transformers\src\FeatureExtractors\ImageFeatureExtractor.php(394): Codewithkyrian\Transformers\Utils\Image->toTensor() #8 [internal function]: Codewithkyrian\Transformers\FeatureExtractors\ImageFeatureExtractor->preprocess(Object(Codewithkyrian\Transformers\Utils\Image)) #9 C:\laragon\www\awdai\vendor\codewithkyrian\transformers\src\FeatureExtractors\ImageFeatureExtractor.php(464): array_map(Array, Array) #10 C:\laragon\www\awdai\vendor\codewithkyrian\transformers\src\Processors\Processor.php(129): Codewithkyrian\Transformers\FeatureExtractors\ImageFeatureExtractor->__invoke(Array) #11 C:\laragon\www\awdai\app\Jobs\RemoveImageBackground.php(41): Codewithkyrian\Transformers\Processors\Processor->__invoke(Object(Codewithkyrian\Transformers\Utils\Image)) #12 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): App\Jobs\RemoveImageBackground->handle() #13 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Container\Util.php(43): Illuminate\Container\BoundMethod::Illuminate\Container{closure}() #14 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(96): Illuminate\Container\Util::unwrapIfClosure(Object(Closure)) #15 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #16 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Container\Container.php(754): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #17 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(126): Illuminate\Container\Container->call(Array) #18 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(170): Illuminate\Bus\Dispatcher->Illuminate\Bus{closure}(Object(App\Jobs\RemoveImageBackground)) #19 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(127): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(App\Jobs\RemoveImageBackground)) #20 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(130): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #21 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(126): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\RemoveImageBackground), false) #22 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(170): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue{closure}(Object(App\Jobs\RemoveImageBackground)) #23 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(127): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(App\Jobs\RemoveImageBackground)) #24 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(121): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #25 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(69): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\DatabaseJob), Object(App\Jobs\RemoveImageBackground)) #26 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(102): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array) #27 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(442): Illuminate\Queue\Jobs\Job->fire() #28 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(392): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions)) #29 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(178): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions)) #30 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(149): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions)) #31 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(132): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default') #32 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle() #33 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Container\Util.php(43): Illuminate\Container\BoundMethod::Illuminate\Container{closure}() #34 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(96): Illuminate\Container\Util::unwrapIfClosure(Object(Closure)) #35 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #36 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Container\Container.php(754): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #37 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Console\Command.php(213): Illuminate\Container\Container->call(Array) #38 C:\laragon\www\awdai\vendor\symfony\console\Command\Command.php(279): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #39 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Console\Command.php(182): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #40 C:\laragon\www\awdai\vendor\symfony\console\Application.php(1094): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #41 C:\laragon\www\awdai\vendor\symfony\console\Application.php(342): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #42 C:\laragon\www\awdai\vendor\symfony\console\Application.php(193): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #43 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(198): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #44 C:\laragon\www\awdai\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(1235): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #45 C:\laragon\www\awdai\artisan(16): Illuminate\Foundation\Application->handleCommand(Object(Symfony\Component\Console\Input\ArgvInput)) #46 {main}
I get the same error when running on Macbook Pro M1 (Sequoia 15.2), with php 8.3 via Laravel Herd.
What worked for me to fix that:
- Go to https://github.com/rindow/rindow-matlib and install the latest version yourself, e.g. 1.1.1
- Copy the
librindowmatlib.sointovendor/codewithkyrian/transformers/libs/librindowmatlib.so
To extend from @chr-hertel comment, the librindowmatlib.so is located in /var/lib/dpkg/alternatives/librindowmatlib.so
Thanks, @chr-hertel, works like a dream.
To further expand on @chr-hertel's solution: If you don't want to install the library, you can also fetch the static object file from the deb archive:
wget -P /tmp https://github.com/rindow/rindow-matlib/releases/download/1.1.1/rindow-matlib_1.1.1-24.04_amd64.deb
dpkg-deb -x /tmp/rindow-matlib_1.1.1-24.04_amd64.deb /tmp/librindowmatlib_extracted
cp /tmp/librindowmatlib_extracted/usr/lib/rindowmatlib-thread/librindowmatlib.so vendor/codewithkyrian/transformers/libs/librindowmatlib.so
I'm also having this issue. Is this an issue with the composer.json dependencies or something else?
"rindow/rindow-math-matrix": "^2.0",
"rindow/rindow-matlib-ffi": "^1.0",
"rindow/rindow-openblas-ffi": "^1.0",
Just execute installation instructions from here https://github.com/rindow/rindow-matlib and copy the result file to /vendor/codewithkyrian/transformers/libs
@CodeWithKyrian is it possible to update the library, so manual steps are no longer required?
@Moskito89 You can use composer require kyriansfriends/transformers instead of composer require codewithkyrian/transformers.
Hello @SkibidiProduction, in my first test, everything seemed to work fine (except for a few notices caused by PHP 8.4)! 👍
Can you explain what you did there? Is the other library a fork or something?
@Moskito89 this is a composer-replace package based on a fork of model-revamp branch of original library.
Since the namespaces in these packages are not distinguished, you can easily switch to the original library after the stable version is released.
Thank you, @SkibidiProduction, this fixed the issue for me. 👍
But regardless of that, I would like to know what happened to @CodeWithKyrian and why there are no more updates?
@martindewawd , Same error happening me in windows os.
PHP 8.2.4 (cli) (built: Mar 14 2023 17:54:25) (ZTS Visual C++ 2019 x64) Copyright (c) The PHP Group Zend Engine v4.2.4, Copyright (c) Zend Technologies with Zend OPcache v8.2.4, Copyright (c), by Zend Technologies
@chr-hertel , i just downloaded windows release from - https://github.com/rindow/rindow-matlib/releases/tag/1.1.1 - i couldn't found -\vendor\codewithkyrian\transformers\libs/librindowmatlib.dll this .dll in \rindow-matlib-1.1.1-win64\lib this folder (downloaded from rindow repository)
@chr-hertel , Then i copied \rindow-matlib-1.1.1-win64\bin\rindowmatlib.dll file and placed in \vendor\codewithkyrian\transformers\libs\librindowmatlib.dll. it works now.