How to fix Training data is missing: Could not find any training data at the given path

Anandaraj Edward 0 Reputation points
2024-11-20T16:51:16.2933333+00:00

How can I resolve the error 'Training data is missing: Could not find any training data at the given path' when creating a custom model for documents containing my organization's data?

I am using the following C# code to create the model. Can you assist me in identifying what I might be missing?

I have already verified the QA& Assist steps, but still same issue.

public class CreateCustomModel

{

public async Task<string> CreateCustomDocumentIntlligenceModel()

{

    // Configuration        

    string endpoint = "https://eastus.api.cognitive.microsoft.com/";

    string apiKey = "{API_Key}";

    string modelId = string.Empty;

    try

    {            

        // Step 2: Train the Custom Model

        string trainingBlobContainerUrl = {FULL_Container_Name_With_SAS_TOKEN};          

        Uri blobContainerUri = new Uri(trainingBlobContainerUrl);

        var client = new DocumentModelAdministrationClient(new Uri(endpoint), new AzureKeyCredential(apiKey));

        // We are selecting the Template build mode in this sample. For more information about the available

        // build modes and their differences, please see:

        // https://aka.ms/azsdk/formrecognizer/buildmode

        BuildDocumentModelOperation operation = await client.BuildDocumentModelAsync(WaitUntil.Completed, blobContainerUri, DocumentBuildMode.Template);

        DocumentModelDetails model = operation.Value;

        Console.WriteLine($"  Model Id: {model.ModelId}");

        Console.WriteLine($"  Created on: {model.CreatedOn}");

        Console.WriteLine("  Document types the model can recognize:");

        foreach (KeyValuePair<string, DocumentTypeDetails> documentType in model.DocumentTypes)

        {

            Console.WriteLine($"    Document type: {documentType.Key} which has the following fields:");

            foreach (KeyValuePair<string, DocumentFieldSchema> schema in documentType.Value.FieldSchema)

            {

                Console.WriteLine($"    Field: {schema.Key} with confidence {documentType.Value.FieldConfidence[schema.Key]}");

            }

        }

        modelId = model.ModelId;

    }

    catch (Exception ex)

    {

        Console.WriteLine($"Error: {ex.Message}");

    }

    return modelId;

}

}
Azure AI Document Intelligence
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2024-11-20T16:51:16.3233333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error message 'Training data is missing: Could not find any training data at the given path' typically indicates that the specified path to your training data in the Azure Blob Storage is incorrect or that the data is not accessible. Here are some steps you can take to resolve this issue:

    1. Check the SAS Token: Ensure that the SAS token you are using in the trainingBlobContainerUrl has the correct permissions (Read, Write, Delete, and List) and that it is not expired.
    2. Verify the Blob Container URL: Make sure that the URL you are using for the blob container is correctly formatted. It should look like this: https://<storage account>.blob.core.windows.net/<container name>?<SAS value>. Double-check that the container name and the storage account name are correct.
    3. Ensure Data Exists: Confirm that the training data (documents) is indeed uploaded to the specified container in Azure Blob Storage. You can do this by accessing the Azure portal and navigating to your storage account.
    4. Organize Your Data: If your training data is organized in subfolders, ensure that your API call is configured to include subfolders. You may need to adjust your request body to specify the prefix if you're using subfolders.
    5. Use the Correct Build Mode: Ensure that you are using the correct build mode for your documents. The DocumentBuildMode.Template is suitable for documents with a consistent structure.

    By following these steps, you should be able to identify and resolve the issue with your training data path.


    References:

    0 comments No comments

  2. Dyaneshwaran Sivashanmugam 21 Reputation points
    2025-11-20T00:02:08.5066667+00:00

    hello, is this issue solved ? i get same error

    I have provided storage account access to document intelligence , what else has to be done here ? i see its creating model , but it says training data missing

    Azure.RequestFailedException: 'Invalid request.

    Status: 200 (OK)

    ErrorCode: InvalidRequest

    Service request succeeded. Response content and headers are not included to avoid logging sensitive data.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.