Skip to content

Matlib version error #88

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

Open
1 of 4 tasks
CViniciusSDias opened this issue Mar 15, 2025 · 5 comments
Open
1 of 4 tasks

Matlib version error #88

CViniciusSDias opened this issue Mar 15, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@CViniciusSDias
Copy link

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

  • 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:

Image

Reproduction

<?php

use function Codewithkyrian\Transformers\Pipelines\pipeline;

require_once __DIR__ . '/vendor/autoload.php';

pipeline('summarization')('Test');
@CViniciusSDias CViniciusSDias added the bug Something isn't working label Mar 15, 2025
@martindewawd
Copy link

I have the same error when installing TransformersPHP in a Windows 11 pro environment in a Laravel project.

Image

PHP version: 8.3.6
Laravel: 12.2.0
TransformersPHP: 0.5.2

Steps to reproduce:

  1. Follow documented installation using composer within a new Laravel project
  2. Pre-install model
  3. 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}

@janushelkjaer
Copy link

I get the same error when running on Macbook Pro M1 (Sequoia 15.2), with php 8.3 via Laravel Herd.

@chr-hertel
Copy link

What worked for me to fix that:

  1. Go to https://github.com/rindow/rindow-matlib and install the latest version yourself, e.g. 1.1.1
  2. Copy the librindowmatlib.so into vendor/codewithkyrian/transformers/libs/librindowmatlib.so

@itpimp
Copy link

itpimp commented Apr 20, 2025

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.

@garritfra
Copy link

garritfra commented Apr 22, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants