Closed victorratts13 closed 2 months ago
Can you provide more information about the model, and some code on how you set things up so I can try to reproduce the error?
Basically, I'm doing a test, but using Laravel Framework in the most current version (11.0). Previously I did a test using a hugface text-to-text model, however, I changed it to the "Hello world" that the transformersphp documentation suggests:
So the code looked like this:
<?php
use Illuminate\Support\Facades\Route;
use function Codewithkyrian\Transformers\Pipelines\pipeline;
Route::get('/', function () {
// return phpinfo();
$pipe = pipeline('sentiment-analysis');
return $pipe('I love transformers!');
});
As you may have noticed, I used phpinfo() to check if the suggested extensions were installed:
UPDATE:
When I was debugging the code I came across this PHP alert
PHP Warning: PHP Startup: Unable to load dynamic library 'ffi' (tried: /usr/local/lib/php/pecl/20230831/ffi (dlopen(/usr/local/lib/php/pecl/20230831/ffi, 0x0009): tried: '/usr/local/lib/php/pecl/20230831/ffi' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/php/pecl/20230831/ffi' (no such file), '/usr/local/lib/php/pecl/20230831/ffi' (no such file)), /usr/local/lib/php/pecl/20230831/ffi.so (dlopen(/usr/local/lib/php/pecl/20230831/ffi.so, 0x0009): tried: '/usr/local/lib/php/pecl/20230831/ffi.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/php/pecl/20230831/ffi.so' (no such file), '/usr/local/lib/php/pecl/20230831/ffi.so' (no such file))) in Unknown on line 0
I imagined it was something with the FFI library, so I decided to install it using perl, however, the message appears to me:
Hello @victorratts13. Does the problem still persist? It appears to be a problem with your FFI setup. If I may ask, how did you php? Herd, Brew or apt-get?
1 - I installed an ubuntu-server VM to test outside my work environment.
2 - I installed all the development packages that transformersphp uses
sudo apt update && sudo apt install -y libffi-dev libz-dev libpng-dev git libzip-dev
3 - I ran the code again and it worked
It remained to install the dependencies that make FFI work within the command line
Oh, that's great. I was going to suggest installing php-ffi using apt-get actually. I'm glad it's all resolved
Your question
I'm working on a personal project where I'm trying to load a simple model for testing. I'm having some problems with FFI where I get the error:
Enviroment:
Context (optional)
No response
Reference (optional)
No response