При выполнении моего обучающего скрипта на 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
Ожидаемое поведение было для Людвига, чтобы обучить модель без каких-либо ошибок.