Skip to content

Unable to find model #86

Open
Open
@CViniciusSDias

Description

@CViniciusSDias

System Info

Linux Mint. 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

"codewithkyrian/transformers": "^0.5.3"

PHP Version

8.3.6

Environment/Platform

  • Command-line application
  • Web application
  • Serverless
  • Other (please specify)

Description

Unable to find model FacebookAI/xlm-roberta-large-finetuned-conll03-english.
Error:

2025-03-07 12:59:43.840023810 [E:onnxruntime:, inference_session.cc:2105 operator()] Exception during initialization: filesystem error: cannot get file size: No such file or directory [.transformers-cache/FacebookAI/xlm-roberta-large-finetuned-conll03-english/onnx/model.onnx_data]

If I copy model.onnx to model.onnx_data, I get the following error:

PHP Fatal error:  Uncaught RuntimeException: Deserialize tensor onnx::MatMul_3029 failed.tensorprotoutils.cc:1085 GetExtDataFromTensorProto External initializer: onnx::MatMul_3029 offset: 1031598080 size to read: 4194304 given file_length: 617782 are out of bounds or can not be read in full. in /home/vinicius/Documentos/code/transformers/vendor/codewithkyrian/transformers/src/FFI/OnnxRuntime.php:106
Stack trace:
#0 /home/vinicius/Documentos/code/transformers/vendor/codewithkyrian/transformers/src/FFI/OnnxRuntime.php(114): Codewithkyrian\Transformers\FFI\OnnxRuntime::checkStatus()
#1 /home/vinicius/Documentos/code/transformers/vendor/codewithkyrian/transformers/src/Utils/InferenceSession.php(262): Codewithkyrian\Transformers\FFI\OnnxRuntime::CreateSession()
#2 /home/vinicius/Documentos/code/transformers/vendor/codewithkyrian/transformers/src/Utils/InferenceSession.php(123): Codewithkyrian\Transformers\Utils\InferenceSession->loadSession()
#3 /home/vinicius/Documentos/code/transformers/vendor/codewithkyrian/transformers/src/Models/Pretrained/PretrainedModel.php(275): Codewithkyrian\Transformers\Utils\InferenceSession->__construct()
#4 /home/vinicius/Documentos/code/transformers/vendor/codewithkyrian/transformers/src/Models/Pretrained/PretrainedModel.php(224): Codewithkyrian\Transformers\Models\Pretrained\PretrainedModel::constructSession()
#5 /home/vinicius/Documentos/code/transformers/vendor/codewithkyrian/transformers/src/Models/Auto/PretrainedMixin.php(77): Codewithkyrian\Transformers\Models\Pretrained\PretrainedModel::fromPretrained()
#6 /home/vinicius/Documentos/code/transformers/teste.php(7): Codewithkyrian\Transformers\Models\Auto\PretrainedMixin::fromPretrained()
#7 {main}
  thrown in /home/vinicius/Documentos/code/transformers/vendor/codewithkyrian/transformers/src/FFI/OnnxRuntime.php on line 106

Reproduction

Run the following file:

<?php

use Codewithkyrian\Transformers\Models\Auto\AutoModel;

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

$model = AutoModel::fromPretrained(
    'FacebookAI/xlm-roberta-large-finetuned-conll03-english',
    quantized: false,
    modelFilename: 'model.onnx'
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions