CodeWithKyrian / transformers-php

Transformers PHP is a toolkit for PHP developers to add machine learning magic to their projects easily.
https://codewithkyrian.github.io/transformers-php/
Apache License 2.0
417 stars 28 forks source link

Calling FFI::new() statically is deprecated #47

Closed k99k5 closed 1 month ago

k99k5 commented 1 month ago

System Info

Swoole 5 + Hyperf

PHP Version

8.3

Environment/Platform

Description

https://www.php.net/manual/en/migration83.deprecated.php

An error occurred during model execution: Calling FFI::new() statically is deprecated

{ "file": "/www/wwwroot/fc-image/vendor/codewithkyrian/transformers/src/Models/Pretrained/PretrainedModel.php", "line": 311, "function": "make", "class": "Codewithkyrian\Transformers\Exceptions\ModelExecutionException", "type": "::" }, { "file": "/www/wwwroot/fc-image/vendor/codewithkyrian/transformers/src/Models/ModelArchitecture.php", "line": 99, "function": "runSession", "class": "Codewithkyrian\Transformers\Models\Pretrained\PretrainedModel", "type": "->" }, { "file": "/www/wwwroot/fc-image/vendor/codewithkyrian/transformers/src/Models/ModelArchitecture.php", "line": 70, "function": "encoderForward", "class": "Codewithkyrian\Transformers\Models\ModelArchitecture", "type": "->" }, { "file": "/www/wwwroot/fc-image/vendor/codewithkyrian/transformers/src/Models/Pretrained/PretrainedModel.php", "line": 291, "function": "forward", "class": "Codewithkyrian\Transformers\Models\ModelArchitecture", "type": "->" }, { "file": "/www/wwwroot/fc-image/vendor/codewithkyrian/transformers/src/Models/Pretrained/PretrainedModel.php", "line": 280, "function": "forward", "class": "Codewithkyrian\Transformers\Models\Pretrained\PretrainedModel", "type": "->" }, { "file": "/www/wwwroot/fc-image/vendor/codewithkyrian/transformers/src/Pipelines/ImageFeatureExtractionPipeline.php", "line": 48, "function": "__invoke", "class": "Codewithkyrian\Transformers\Models\Pretrained\PretrainedModel", "type": "->" },

Reproduction

...

k99k5 commented 1 month ago

I modified the dump method in the file vendor/codewithkyrian/transformers/src/Tensor/TensorBuffer.php, and it ran successfully.