1

我正在尝试使用 Xcode 操场上的 CreateML 训练我自己的 NLP 模型,并通过 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
4

0 回答 0