Модель обучения с использованием CreateML MLTextClassifier, остановленная EXC_BAD_ACCESS (код = 1, адрес = 0x0) - PullRequest
0 голосов
/ 31 мая 2019

Я пытаюсь обучить свою собственную модель НЛП с помощью CreateML с игровой площадкой Xcode и прохожу учебное руководство от Apple: https://developer.apple.com/documentation/createml/creating_a_text_classifier_model

но программа завершена EXC_BAD_ACCESS (код = 1, адрес = 0x0)

Я нашел какое-то решение из Интернета, они заявили, что указатель указывает на NULL при попытке доступа к переменной

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