Custom ML model retraining error

Hi, I created a custom ML model and set it to be retrainable, I could upload the MLSkill without problems, but when I try to train, (any type of pipeline) it fails and I get this error mensage:

Traceback (most recent call last):
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/trainer_run.py”, line 76, in main
wrapper.run()
File “/microservice/training_wrapper.py”, line 57, in run
return self.training_plugin.model_run()
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/training_plugin.py”, line 138, in model_run
raise e
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/training_plugin.py”, line 130, in model_run
self.run_train_only()
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/training_plugin.py”, line 199, in run_train_only
self.train_model(self.local_dataset_directory)
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/training_plugin.py”, line 103, in train_model
self.model.train(directory)
File “/microservice/train.py”, line 22, in train
df = pd.read_csv(training_directory)
File “/home/aifabric/.local/lib/python3.8/site-packages/pandas/io/parsers.py”, line 688, in read_csv
return _read(filepath_or_buffer, kwds)
File “/home/aifabric/.local/lib/python3.8/site-packages/pandas/io/parsers.py”, line 454, in _read
parser = TextFileReader(fp_or_buf, **kwds)
File “/home/aifabric/.local/lib/python3.8/site-packages/pandas/io/parsers.py”, line 948, in init
self._make_engine(self.engine)
File “/home/aifabric/.local/lib/python3.8/site-packages/pandas/io/parsers.py”, line 1180, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File “/home/aifabric/.local/lib/python3.8/site-packages/pandas/io/parsers.py”, line 2010, in init
self._reader = parsers.TextReader(src, **kwds)
File “pandas/_libs/parsers.pyx”, line 537, in pandas._libs.parsers.TextReader.cinit
File “pandas/_libs/parsers.pyx”, line 711, in pandas._libs.parsers.TextReader._get_header
File “pandas/_libs/parsers.pyx”, line 905, in pandas._libs.parsers.TextReader._tokenize_rows
File “pandas/_libs/parsers.pyx”, line 2042, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: Calling read(nbytes) on source failed. Try engine=‘python’.
Traceback (most recent call last):
File “/usr/local/bin/uipath-core-training”, line 8, in
sys.exit(main())
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/trainer_run.py”, line 82, in main
raise e
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/trainer_run.py”, line 76, in main
wrapper.run()
File “/microservice/training_wrapper.py”, line 57, in run
return self.training_plugin.model_run()
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/training_plugin.py”, line 138, in model_run
raise e
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/training_plugin.py”, line 130, in model_run
self.run_train_only()
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/training_plugin.py”, line 199, in run_train_only
self.train_model(self.local_dataset_directory)
File “/home/aifabric/.local/lib/python3.8/site-packages/uipath_core/training_plugin.py”, line 103, in train_model
self.model.train(directory)
File “/microservice/train.py”, line 22, in train
df = pd.read_csv(training_directory)
File “/home/aifabric/.local/lib/python3.8/site-packages/pandas/io/parsers.py”, line 688, in read_csv
return _read(filepath_or_buffer, kwds)
File “/home/aifabric/.local/lib/python3.8/site-packages/pandas/io/parsers.py”, line 454, in _read
parser = TextFileReader(fp_or_buf, **kwds)
File “/home/aifabric/.local/lib/python3.8/site-packages/pandas/io/parsers.py”, line 948, in init
self._make_engine(self.engine)
File “/home/aifabric/.local/lib/python3.8/site-packages/pandas/io/parsers.py”, line 1180, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "/home/aifabric/.local/lib/pytho… (truncated).

Can anyone help me?

Hi

Hard to say without seeing the code but looks like your are doing pd.read_csv on a directory instead of a csv file?
Jeremy

on the train.py I use this ‘pd.read_csv(training_directory)’ to get the new data, this training_directory is the input of the train function mentioned on the AIFabric documentation, but the dataset file I use as input is an csv.

ok I guess this is the issue then pd.read_csv expect path to the file not ot the directory so it should be something like training_directory/filename.csv. If filename is not always the same (or if you have several) you need to look for all csv files in training_directory and then use pd.read_csv

1 Like

Thank you, It worked!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.