<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreML",
  "identifier" : "/documentation/CoreML/MLUpdateTask/init(forModelAt:trainingData:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core ML"
    ],
    "preciseIdentifier" : "c:objc(cs)MLUpdateTask(cm)updateTaskForModelAtURL:trainingData:completionHandler:error:"
  },
  "title" : "init(forModelAt:trainingData:completionHandler:)"
}
-->

# init(forModelAt:trainingData:completionHandler:)

Creates a task that updates the model at the URL with the training data, and calls the completion handler when the update completes.

```
convenience init(forModelAt modelURL: URL, trainingData: any MLBatchProvider, completionHandler: @escaping (MLUpdateContext) -> Void) throws
```

## Parameters

`modelURL`

The location in the file system of a model file (*ModelName*`.mlmodelc`).

`trainingData`

The update data for the model, contained in a batch provider.

`completionHandler`

The closure the task calls when it finishes.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)