Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DtypeWarning: Columns (0,1) have mixed types. Specify dtype option on import or set low_memory=False #311

Open
mathieuchateau opened this issue Aug 24, 2022 · 2 comments

Comments

@mathieuchateau
Copy link

Hello,
I am quite new on the topic, sorry if it's a false issue.

When loading with BertDataBunch, I got this warning:

lib/python3.9/site-packages/fast_bert/data_cls.py:231: DtypeWarning: Columns (0,1) have mixed types. Specify dtype option on import or set low_memory=False.
  data_df = pd.read_csv(os.path.join(self.data_dir, filename))

I already have this sort of issue with panda in my code, but with BertDataBunch I can't find a way to set dtype option ?
Installed fast-bert yesterday, so latest version I guess

databunch = BertDataBunch(DATA_PATH, LABEL_PATH,
                              tokenizer='camembert-base',
                              train_file='train_set.csv',
                              val_file='val_set.csv',
                              label_file='labels.txt',
                              text_col='source_clean',
                              label_col=['aaa', 'bbb', 'ccc','ddd', 'eee'],
                              batch_size_per_gpu=16,
                              max_seq_length=512,
                              multi_gpu=False,
                              multi_label=True,
                              model_type='camembert-base')
@mathieuchateau
Copy link
Author

Second warning during same run on another line (248):

lib/python3.9/site-packages/fast_bert/data_cls.py:248: DtypeWarning: Columns (0,1) have mixed types. Specify dtype option on import or set low_memory=False.
  data_df = pd.read_csv(os.path.join(self.data_dir, filename))

@lingdoc
Copy link
Contributor

lingdoc commented Aug 26, 2022

this is related to the format of your datafiles, which can lead to issues when importing a CSV via a pandas dataframe. I might submit a pull request to allow xlsx files instead, since these have better handling for rows/columns, but for now one workaround is to ensure all your text in a CSV is surrounded by double quotes: "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants