I have a 2-column CSV, reading the CSV using Python gives below following stack trace. Notice on last line the error is: Columns ‘clause’ could not be found in the provided file (which has columns: ‘clause’,‘category’)
Traceback (most recent call last):
File “C:\Users\foo\HuggingFace\project1.py”, line 7, in
project.upload(
File “C:\Users\foo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\autonlp\project.py”, line 235, in upload
validate_file(
File “C:\Users\foo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\autonlp\validation.py”, line 93, in validate_file
raise InvalidColMappingError(
autonlp.validation.InvalidColMappingError: Columns ‘clause’ could not be found in the provided file (which has columns: ‘clause’,‘category’)
Python code:
from autonlp import AutoNLP
client = AutoNLP()
client.login(token=“MY-KEY”)
project = client.create_project(name=“clause_classification”, task=“multi_class_classification”, language=“en”, max_models=5)
project.upload(foo\Downloads\clause_classifier_train_4L.csv"],
split=“train”,
col_mapping={
“clause”: “text”,
“category”: “target”
})
Solved the issue:
Added a dummy first column. Now file can be loaded without column name error. Bug seems to be that a leading space is erroneously added to name of first column