Skip to content

install is not defined/Error Model can not be found #98

Closed

Description

@Jieoogle

Your question

Hello, as the title suggests im struggling with 2 Problems, which i assume might be related so i put both of them in here. After going through other peoples Issues and Fixes i was finally able to Pre-Download a Model. But now being able to do that i get the Error Message:

Command "install" is not defined.

Whenever i try to run ".\vendor\bin\transformers install".
Since this Command didnt do anything before but throw out an Error.

And the Second Issue im facing is an Error from my code:

require "./vendor/autoload.php";
use function Codewithkyrian\Transformers\Pipelines\pipeline;

$extractor = pipeline('embeddings', 'Xenova\all-MiniLM-L6-v2');
$embeddings = $extractor('The quick brown fox jumps over the lazy dog.', true, 'mean');
print($embeddings);

Which outputs to my localhost:

Fatal error: Uncaught RuntimeException: Load model from .transformers-cache\Xenova\all-MiniLM-L6-v2\onnx\model_quantized.onnx failed:Load model .transformers-cache\Xenova\all-MiniLM-L6-v2\onnx\model_quantized.onnx failed. File doesn't exist in C:\Server\web\vendor\codewithkyrian\transformers\src\FFI\OnnxRuntime.php:70 Stack trace:
#0 C:\Server\web\vendor\codewithkyrian\transformers\src\FFI\OnnxRuntime.php(78): Codewithkyrian\Transformers\FFI\OnnxRuntime->checkStatus(Object(FFI\CData:struct OrtStatus*))
#1 C:\Server\web\vendor\codewithkyrian\transformers\src\Utils\InferenceSession.php(276): Codewithkyrian\Transformers\FFI\OnnxRuntime->CreateSession(Object(FFI\CData:struct OrtEnv*), Object(FFI\CData:char[140]), Object(FFI\CData:struct OrtSessionOptions*))
#2 C:\Server\web\vendor\codewithkyrian\transformers\src\Utils\InferenceSession.php(126): Codewithkyrian\Transformers\Utils\InferenceSession->loadSession('.transformers-c...', Object(FFI\CData:struct OrtSessionOptions*))
#3 C:\Server\web\vendor\codewithkyrian\transformers\src\Models\Pretrained\PretrainedModel.php(286): Codewithkyrian\Transformers\Utils\InferenceSession->__construct('.transformers-c...')
#4 C:\Server\web\vendor\codewithkyrian\transformers\src\Models\Pretrained\PretrainedModel.php(236): Codewithkyrian\Transformers\Models\Pretrained\PretrainedModel::constructSession('Xenova\all-Mini...', 'model_quantized', NULL, 'main', 'onnx', true, NULL)
#5 C:\Server\web\vendor\codewithkyrian\transformers\src\Models\Auto\AutoModelBase.php(68): Codewithkyrian\Transformers\Models\Pretrained\PretrainedModel::fromPretrained('Xenova\all-Mini...', true, Object(Codewithkyrian\Transformers\Configs\PretrainedConfig), NULL, NULL, 'main', NULL, Codewithkyrian\Transformers\Models\ModelArchitecture::EncoderOnly, NULL)
#6 C:\Server\web\vendor\codewithkyrian\transformers\src\Pipelines\Pipeline.php(85): Codewithkyrian\Transformers\Models\Auto\AutoModelBase::fromPretrained('Xenova\all-Mini...', true, Object(Codewithkyrian\Transformers\Configs\PretrainedConfig), NULL, 'main', NULL, NULL)
#7 C:\Server\web\index.php(6): Codewithkyrian\Transformers\Pipelines\pipeline(Codewithkyrian\Transformers\Pipelines\Task::Embeddings, 'Xenova\all-Mini...')
#8 {main} Next RuntimeException: Could not instantiate model for task: embeddings in C:\Server\web\vendor\codewithkyrian\transformers\src\Pipelines\Pipeline.php:93 Stack trace:
#0 C:\Server\web\index.php(6): Codewithkyrian\Transformers\Pipelines\pipeline(Codewithkyrian\Transformers\Pipelines\Task::Embeddings, 'Xenova\all-Mini...')
#1 {main} thrown in C:\Server\web\vendor\codewithkyrian\transformers\src\Pipelines\Pipeline.php on line 93

I'm using PHP 8.4.11 and Windows 10.
Any help would be appreciated and if you need some more details on something please ask, i dont know what else to provide right now :)

Context (optional)

No response

Reference (optional)

No response

Activity

  1. Jieoogle commented on Sep 9, 2025

    @Jieoogle
    Author

    Ok so, i "fixed" it. I specified a path to the transformer-cache Folder and changed the deprecated null types to the new system.
    It seems to work now.

    $extractor = pipeline('embeddings', 'Xenova/all-MiniLM-L6-v2', false, null, DIR. '.transformers-cache');

    from this: int $dtype = null
    v
    to this: ?int $dtype = null

    This is how it looks now, and I just ignored the install part because i seems unnecessary now.

    Also a big thanks for creating this library and giving something so big to the php community<3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions