执行我的训练 python 脚本时,返回以下内容。
Traceback (most recent call last):
File "train.py", line 14, in <module>
train_stats = model.train(data_csv="./dataset.csv")
File "/home/user/.local/lib/python3.7/site-packages/ludwig/api.py", line 441, in train
debug=debug,
File "/home/user/.local/lib/python3.7/site-packages/ludwig/train.py", line 252, in full_train
random_seed=random_seed
File "/home/user/.local/lib/python3.7/site-packages/ludwig/data/preprocessing.py", line 403, in preprocess_for_training
random_seed
File "/home/user/.local/lib/python3.7/site-packages/ludwig/data/preprocessing.py", line 525, in _preprocess_csv_for_training
random_seed=random_seed
File "/home/user/.local/lib/python3.7/site-packages/ludwig/data/preprocessing.py", line 62, in build_dataset
**kwargs
File "/home/user/.local/lib/python3.7/site-packages/ludwig/data/preprocessing.py", line 83, in build_dataset_df
global_preprocessing_parameters
File "/home/user/.local/lib/python3.7/site-packages/ludwig/data/preprocessing.py", line 116, in build_metadata
feature['preprocessing']
File "/home/user/.local/lib/python3.7/site-packages/ludwig/utils/misc.py", line 97, in merge_dict
for k, v in merge_dct.items():
AttributeError: 'list' object has no attribute 'items'
我浏览了路德维希的文档,对此感到困惑。
from ludwig.api import LudwigModel
model_definition = {
"input_features":[
{"name":"image_path", "type":"image", "preprocessing":[{"height": "128", "width": "128"}],"resize_method": "interpolate"}
],
"output_features":[
{"name":"plate","type":"text"}
]
}
model = LudwigModel(model_definition)
train_stats = model.train(data_csv="./dataset.csv")
我的 CSV 源的格式是这样的。
image_path, plate
./crop_m1/I00000.png, 9B52145
./crop_h1/I00000.png, 9B52145
./crop_m1/I00001.png, 6B94558
./crop_h1/I00001.png, 6B94558
./crop_m1/I00002.png, 8B90164
./crop_h1/I00002.png, 8B90164
./crop_m1/I00003.png, 5B11181
./crop_h1/I00003.png, 5B11181
./crop_m1/I00004.png, 8B79697
./crop_h1/I00004.png, 8B79697
./crop_m1/I00005.png, 8B90164
ludwig 的预期行为是训练模型没有任何错误。