You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SO: Ubuntu (under WSL) - Linux NotebookG15 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
PHP Version
8.3.6
Environment/Platform
Command-line application
Web application
Serverless
Other (please specify)
Description
When trying to execute any simple code using TransformersPHP, I get the following error:
PHP Fatal error: Uncaught TypeError: Codewithkyrian\Transformers\Utils\AutoConfig::__construct(): Argument #1 ($config) must be of type array, null given, called in /tmp/transformersphp/vendor/codewithkyrian/transformers/src/Utils/AutoConfig.php on line 53 and defined in /tmp/transformersphp/vendor/codewithkyrian/transformers/src/Utils/AutoConfig.php:26
Stack trace:
#0 /tmp/transformersphp/vendor/codewithkyrian/transformers/src/Utils/AutoConfig.php(53): Codewithkyrian\Transformers\Utils\AutoConfig->__construct()
#1 /tmp/transformersphp/vendor/codewithkyrian/transformers/src/Models/Auto/PretrainedMixin.php(53): Codewithkyrian\Transformers\Utils\AutoConfig::fromPretrained()
#2 /tmp/transformersphp/vendor/codewithkyrian/transformers/src/Pipelines/Task.php(101): Codewithkyrian\Transformers\Models\Auto\PretrainedMixin::fromPretrained()
#3 /tmp/transformersphp/vendor/codewithkyrian/transformers/src/Pipelines/Pipeline.php(79): Codewithkyrian\Transformers\Pipelines\Task->pretrainedModel()
#4 /tmp/transformersphp/transformers.php(7): Codewithkyrian\Transformers\Pipelines\pipeline()
#5 {main}
thrown in /tmp/transformersphp/vendor/codewithkyrian/transformers/src/Utils/AutoConfig.php on line 26
Reproduction
Run the following code:
<?php
use function Codewithkyrian\Transformers\Pipelines\pipeline;
require 'vendor/autoload.php';
$classifier = pipeline('sentiment-analysis');
var_dump($classifier('I love TransformersPHP!'));
This returns https:/huggingface.co/Xenova/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/config.json, with https:/ instead of https://, which is incorrect.
Please open a new issue if you encounter problems with the package, unless it's part of an ongoing discussion.
Regarding your concern, the download command is specifically designed to download PreTrained models from the Huggingface hub or any custom host—not shared libraries. If your shared libraries aren't set up correctly, you can run the ./vendor/bin/transformers download command to re-download them and place them in the appropriate directories. For more detailed instructions, please refer to the documentation.
Activity
CViniciusSDias commentedon Apr 13, 2024
src/Utils/Helpers.php:77 has the following line:
This returns
https:/huggingface.co/Xenova/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/config.json, withhttps:/instead ofhttps://, which is incorrect.CodeWithKyrian commentedon Apr 13, 2024
Thanks for bringing it to my attention. The PR has been merged but it'll be part of the upcoming v0.3.0 release in few hours
Tinywan commentedon Aug 22, 2024
PHP Version
CodeWithKyrian commentedon Aug 22, 2024
Hi @Tinywan,
Please open a new issue if you encounter problems with the package, unless it's part of an ongoing discussion.
Regarding your concern, the
downloadcommand is specifically designed to download PreTrained models from the Huggingface hub or any custom host—not shared libraries. If your shared libraries aren't set up correctly, you can run the./vendor/bin/transformers downloadcommand to re-download them and place them in the appropriate directories. For more detailed instructions, please refer to the documentation.Tinywan commentedon Aug 23, 2024
OK #62