1

I'm trying to train my own NLP model with CreateML with Xcode playground, and going through the tutorial by Apple: https://developer.apple.com/documentation/createml/creating_a_text_classifier_model

but the program terminated by EXC_BAD_ACCESS (code=1, address=0x0)

I found some solution from the Internet, they stated that the pointer is pointing to NULL when trying to access the variable

import Foundation
import CreateML

let source = "icecream"

let data = try MLDataTable(contentsOf: URL(fileURLWithPath: "/path/to/\(source).csv"))

let (trainingData, testingData) = data.randomSplit(by: 0.8, seed: 0)

// program stopped here
let sentimentClassifier = try MLTextClassifier(trainingData: trainingData, textColumn: "text", labelColumn: "sentiment")
// error
error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x0).

// output
Finished parsing file /path/to/icecream.csv
Parsing completed. Parsed 100 lines in 0.03412 secs.
Finished parsing file /path/to/icecream.csv
Parsing completed. Parsed 188 lines in 0.008235 secs.
Automatically generating validation set from 10% of the data.
Tokenizing data and extracting features
Starting MaxEnt training with 146 samples
Iteration 1 training accuracy 0.650685
Iteration 2 training accuracy 0.869863
Iteration 3 training accuracy 0.945205
Iteration 4 training accuracy 0.986301
Iteration 5 training accuracy 0.993151
Finished MaxEnt training in 0.04 seconds
cokenhe
  • 41
  • 6

0 Answers0