Я пытался заставить работать пакетную отправку документов AI, но столкнулся с некоторыми трудностями. У меня есть отправка одного файла с использованием RawDocument, и предположим, что я мог бы просто перебрать свой набор данных (27 тысяч изображений), но выбрал пакетную обработку, поскольку это кажется более подходящим методом.
Когда я запускаю свой код Я вижу ошибку: «Не удалось обработать все документы». Первые несколько строк отладочной информации:
O:17:"Google\Rpc\Status":5:{
s:7 :"*code";i:3;s:10:"*message";s:32:"Не удалось обработать все документы.";
s:26:"Google\Rpc\Statusdetails";
O:38:"Google\Protobuf\Internal\RepeatedField":4:{
s:49:"Google\Protobuf\Internal\RepeatedFieldcontainer";a:0:{}s:44:"Google\Protobuf\Internal\RepeatedFieldtype";i:11;s:45:"Google\Protobuf\Internal \RepeatedF ieldklass";s:19:"Google\Protobuf\Any";s:52:"Google\Protobuf\Internal\RepeatedFieldlegacy_klass";s:19:"Google\Protobuf\Any";}s:38:"Google\Protobuf \Внутренний\Мес sagedesc";O:35:"Google\Protobuf\Internal\Descriptor":13:{s:46:"Google\Protobuf\Internal\Descriptorfull_name";s:17:"google.rpc.Status";s:42: "Google\Protobuf\In ternal\Descriptorfield";a:3:{i:1;O:40:"Google\Protobuf\Internal\FieldDescriptor":14:{s:46:"Google\Protobuf\Internal\FieldDescriptorname";s:4:" код";```
В службе поддержки этой ошибки указано, что причина ошибки:
GcsUriPrefix и gcsOutputConfig. Параметры gcsUri должны начинаться с gs:// и заканчиваться обратной косой чертой (/). Проверьте конфигурацию URI сегментов.
Я не использую gcsUriPrefix (следует ли? Мои сегменты > максимального предела пакета), но мой gcsOutputConfig.gcsUri находится в пределах эти пределы. В списке файлов, который я предоставил, указаны имена файлов (указаны на правую область), поэтому в конце не должно быть обратной косой черты.
Советы приветствуются
function filesFromBucket( $directoryPrefix ) {
// NOT recursive, does not search the structure
$gcsDocumentList = [];
// see https://cloud.google.com/storage/docs/s ... ith-prefix
$bucketName = 'my-input-bucket';
$storage = new StorageClient();
$bucket = $storage->bucket($bucketName);
$options = ['prefix' => $directoryPrefix];
foreach ($bucket->objects($options) as $object) {
$doc = new GcsDocument();
$doc->setGcsUri('gs://'.$object->name());
$doc->setMimeType($object->info()['contentType']);
array_push( $gcsDocumentList, $doc );
}
$gcsDocuments = new GcsDocuments();
$gcsDocuments->setDocuments($gcsDocumentList);
return $gcsDocuments;
}
function batchJob ( ) {
$inputConfig = new BatchDocumentsInputConfig( ['gcs_documents'=>filesFromBucket('the-bucket-path/')] );
// see https://cloud.google.com/php/docs/refer ... tputConfig
// nb: all uri paths must end with / or an error will be generated.
$outputConfig = new DocumentOutputConfig(
[ 'gcs_output_config' =>
new GcsOutputConfig( ['gcs_uri'=>'gs://my-output-bucket/'] ) ]
);
// see https://cloud.google.com/php/docs/refer ... viceClient
$documentProcessorServiceClient = new DocumentProcessorServiceClient();
try {
// derived from the prediction endpoint
$name = 'projects/######/locations/us/processors/#######';
$operationResponse = $documentProcessorServiceClient->batchProcessDocuments($name, ['inputDocuments'=>$inputConfig, 'documentOutputConfig'=>$outputConfig]);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
printf('
result: %s
',serialize($result));
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
printf('
error: %s
', serialize($error));
// handleError($error)
}
} finally {
$documentProcessorServiceClient->close();
}
}
Подробнее здесь: https://stackoverflow.com/questions/763 ... em-correct
Ошибка отправки пакетного задания «Не удалось обработать все документы», URIS кажется правильным? ⇐ Php
Кемеровские программисты php общаются здесь
1736795063
Anonymous
Я пытался заставить работать пакетную отправку документов AI, но столкнулся с некоторыми трудностями. У меня есть отправка одного файла с использованием RawDocument, и предположим, что я мог бы просто перебрать свой набор данных (27 тысяч изображений), но выбрал пакетную обработку, поскольку это кажется более подходящим методом.
Когда я запускаю свой код Я вижу ошибку: «Не удалось обработать все документы». Первые несколько строк отладочной информации:
O:17:"Google\Rpc\Status":5:{
s:7 :"*code";i:3;s:10:"*message";s:32:"Не удалось обработать все документы.";
s:26:"Google\Rpc\Statusdetails";
O:38:"Google\Protobuf\Internal\RepeatedField":4:{
s:49:"Google\Protobuf\Internal\RepeatedFieldcontainer";a:0:{}s:44:"Google\Protobuf\Internal\RepeatedFieldtype";i:11;s:45:"Google\Protobuf\Internal \RepeatedF ieldklass";s:19:"Google\Protobuf\Any";s:52:"Google\Protobuf\Internal\RepeatedFieldlegacy_klass";s:19:"Google\Protobuf\Any";}s:38:"Google\Protobuf \Внутренний\Мес sagedesc";O:35:"Google\Protobuf\Internal\Descriptor":13:{s:46:"Google\Protobuf\Internal\Descriptorfull_name";s:17:"google.rpc.Status";s:42: "Google\Protobuf\In ternal\Descriptorfield";a:3:{i:1;O:40:"Google\Protobuf\Internal\FieldDescriptor":14:{s:46:"Google\Protobuf\Internal\FieldDescriptorname";s:4:" код";```
В службе поддержки этой ошибки указано, что причина ошибки:
GcsUriPrefix и gcsOutputConfig. Параметры gcsUri должны начинаться с gs:// и заканчиваться обратной косой чертой (/). Проверьте конфигурацию URI сегментов.
Я не использую gcsUriPrefix (следует ли? Мои сегменты > максимального предела пакета), но мой gcsOutputConfig.gcsUri находится в пределах эти пределы. В списке файлов, который я предоставил, указаны имена файлов (указаны на правую область), поэтому в конце не должно быть обратной косой черты.
Советы приветствуются
function filesFromBucket( $directoryPrefix ) {
// NOT recursive, does not search the structure
$gcsDocumentList = [];
// see https://cloud.google.com/storage/docs/samples/storage-list-files-with-prefix
$bucketName = 'my-input-bucket';
$storage = new StorageClient();
$bucket = $storage->bucket($bucketName);
$options = ['prefix' => $directoryPrefix];
foreach ($bucket->objects($options) as $object) {
$doc = new GcsDocument();
$doc->setGcsUri('gs://'.$object->name());
$doc->setMimeType($object->info()['contentType']);
array_push( $gcsDocumentList, $doc );
}
$gcsDocuments = new GcsDocuments();
$gcsDocuments->setDocuments($gcsDocumentList);
return $gcsDocuments;
}
function batchJob ( ) {
$inputConfig = new BatchDocumentsInputConfig( ['gcs_documents'=>filesFromBucket('the-bucket-path/')] );
// see https://cloud.google.com/php/docs/reference/cloud-document-ai/latest/V1.DocumentOutputConfig
// nb: all uri paths must end with / or an error will be generated.
$outputConfig = new DocumentOutputConfig(
[ 'gcs_output_config' =>
new GcsOutputConfig( ['gcs_uri'=>'gs://my-output-bucket/'] ) ]
);
// see https://cloud.google.com/php/docs/reference/cloud-document-ai/latest/V1.DocumentProcessorServiceClient
$documentProcessorServiceClient = new DocumentProcessorServiceClient();
try {
// derived from the prediction endpoint
$name = 'projects/######/locations/us/processors/#######';
$operationResponse = $documentProcessorServiceClient->batchProcessDocuments($name, ['inputDocuments'=>$inputConfig, 'documentOutputConfig'=>$outputConfig]);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
printf('
result: %s
',serialize($result));
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
printf('
error: %s
', serialize($error));
// handleError($error)
}
} finally {
$documentProcessorServiceClient->close();
}
}
Подробнее здесь: [url]https://stackoverflow.com/questions/76376656/batch-job-submission-error-failed-to-process-all-documents-uris-seem-correct[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия