Train-curve ends in error (module 'plotext' has no attribute 'colorless')

Hello everyone.

I was using train-curve, with the following results:

=========================== Train curve diagnostic ===========================
Training 5 times with 20%, 40%, 60%, 80%, 100% of the data

%      Score    ner   
----   ------   ------
  0%   0.00     0.00  
 20%   0.38 ▲   0.38 ▲
 40%   0.42 ▲   0.42 ▲
 60%   0.45 ▲   0.45 ▲
 80%   0.47 ▲   0.47 ▲
100%   0.46 ▼   0.46 ▼

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/dist-packages/prodigy/__main__.py", line 61, in <module>
    controller = recipe(*args, use_plac=True)
  File "cython_src/prodigy/core.pyx", line 329, in prodigy.core.recipe.recipe_decorator.recipe_proxy
  File "/usr/local/lib/python3.8/dist-packages/plac_core.py", line 367, in call
    cmd, result = parser.consume(arglist)
  File "/usr/local/lib/python3.8/dist-packages/plac_core.py", line 232, in consume
    return cmd, self.func(*(args + varargs + extraopts), **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/prodigy/recipes/train.py", line 387, in train_curve
    prev_scores = scores
  File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "cython_src/prodigy/components/printers.pyx", line 75, in train_curve_printer
AttributeError: module 'plotext' has no attribute 'colorless'

As you can see, the results table displays normally, just to fail afterwards, during the curve plotting, with the error AttributeError: module 'plotext' has no attribute 'colorless'. BTW I am currently using prodigy==1.11.7 and plotext==5.0.2. The only thing I have found in 'plotext' changelog, vaguely related to my issue, is this one, but no naming convention change was found (as in this case).

Is there any "plotext recommended version"? Other than that, any ideas?

2 Likes

Hi @dave-espinosa ,

Can you try installing plotext==4.2.0? It seems that plotext released a major version a few days ago and removed the colorless parameter and replaced it with clear_color. Thanks for reporting this too!

1 Like

Hello @ljvmiranda921 ,

I have downgraded to plotext==4.2.0, and I am now getting the desired graph:

=========================== Train curve diagnostic ===========================
Training 2 times with 50%, 100% of the data

%      Score    ner   
----   ------   ------
  0%   0.01     0.01  
 50%   0.48 ▲   0.48 ▲
100%   0.54 ▲   0.54 ▲

    ┌──────────────────────────────────┐
0.54┤                     ▗▄▄▄▄▄▄▄▞▀▀▀▀│
0.48┤               ▗▞▀▀▀▀▘            │
    │             ▗▞▘                  │
    │           ▄▀▘                    │
    │        ▗▄▀                       │
    │      ▗▞▘                         │
    │    ▄▞▘                           │
    │  ▄▀                              │
0.01┤▄▀                                │
    └┬────────────────┬───────────────┬┘
     0%              50%           100% 

✔ Accuracy improved in the last sample
As a rule of thumb, if accuracy increases in the last segment, this could
indicate that collecting more annotations of the same type will improve the
model further.

Therefore, the containment solution works.

I am curious now: Is prodigy "automatically" updated or not, by any chance?

The reason I am asking this, is because if it is not, then I think we can keep working with this containment; however if it is, then of course we might need to upgrade plotext once this issue appears again.

Let me know your comments please.

Thank you!

Hi @dave-espinosa , similar to any Python dependency, you have to update Prodigy via pip. For now, if you have a project that uses train-curve, you can pin the plotext dependency in your requirements.txt file

# requirements.txt
prodigy
plotext==4.2.0

I think pinning some dependencies is actually a good practice to maintain the same environment all throughout. Especially given that third-party dependencies tend to update and be "out-of-sync" with one another.

3 Likes

Hello @ljvmiranda921 ,

Thank you very much for your guidance and recommendations.

From my side, please consider the case closed.

I hit the same error and was about to start a new thread, but thanks to suggestions, saw this one, which solved my problem. So, thanks a lot! @dave-espinosa and @ljvmiranda921! :slight_smile:

1 Like