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

Pandas whitespace error fix #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amorisot
Copy link

Before training starts I get this error: pandas.errors.ParserError: Expected 8 fields in line 7, saw 9. Error could possibly be due to quotes being ignored when a multi-char delimiter is used.

It's due to the space in chrome 00type=g line below, which is what you obtain after you process the output of nvidia-smi in the get_nvidia_gpu_power function.

    gpu        pid  type    sm   mem   enc   dec   command
    0       1351     G     0     0     0     0   Xorg
    0       1441     G     0     0     0     0   gnome0shell
    0       1973     G     0     0     0     0   Xorg
    0       2090     G     0     0     0     0   gnome0shell
    0      83636     C     0     0     0     0   python
    0     105873     G     0     0     0     0   chrome 00type=g
    0       1807     C     4     1     0     0   python3
    0       2090     G     4     0     0     0   gnome0shell
    0       1807     C     0     0     0     0   python3
    0       2090     G     6     0     0     0   gnome0shell
    0       2090     G     2     0     0     0   gnome0shell

When running that table through pd.read_csv(StringIO(out_str_final), delim_whitespace=True), delim_whitespace turns chrome 00type=g into 2 columns.

To fix, before doing out_str_final = out_str_final.replace("-", "0"), do out_str_final = out_str_final.replace(" --", "").

Before training starts I get this error: `pandas.errors.ParserError: Expected 8 fields in line 7, saw 9. Error could possibly be due to quotes being ignored when a multi-char delimiter is used.`

It's due to the space in `chrome 00type=g` line below, which is what you obtain after you process the output of `nvidia-smi` in the `get_nvidia_gpu_power` function.
```
    gpu        pid  type    sm   mem   enc   dec   command
    0       1351     G     0     0     0     0   Xorg
    0       1441     G     0     0     0     0   gnome0shell
    0       1973     G     0     0     0     0   Xorg
    0       2090     G     0     0     0     0   gnome0shell
    0      83636     C     0     0     0     0   python
    0     105873     G     0     0     0     0   chrome 00type=g
    0       1807     C     4     1     0     0   python3
    0       2090     G     4     0     0     0   gnome0shell
    0       1807     C     0     0     0     0   python3
    0       2090     G     6     0     0     0   gnome0shell
    0       2090     G     2     0     0     0   gnome0shell
```

When running that table through `pd.read_csv(StringIO(out_str_final), delim_whitespace=True)`, `delim_whitespace` turns `chrome 00type=g` into 2 columns.

To fix, before doing `out_str_final = out_str_final.replace("-", "0")`, do `out_str_final = out_str_final.replace(" --", "")`.
@Breakend Breakend mentioned this pull request Aug 16, 2020
@cifkao
Copy link

cifkao commented Nov 30, 2020

Fixes #36.

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

Successfully merging this pull request may close these issues.

2 participants