-
Notifications
You must be signed in to change notification settings - Fork 517
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
Error: 'charmap' codec can't encode characters #999
Comments
Hi @T0T4R4 Meanwhile, you can try: training_hyperparams['silent_mode'] = True
Trainer.train(..., training_hyperparams) |
Should I follow up the discussion on DashHub or here ? Thanks @Louis-Dupont , looks like by changing the silent_mode back to True (I had it explicitely on False to follow with what happens while training and estimate the time it takes), the code ended gracefully. So thanks for the tip ! 👍 Still, it would be nice to have it working while disabled :) |
Let's continue here, it's more convenient for people to see the discussion :) Definitely, I am just not fully sure what causes it. If you have a few seconds to run the following code it would help me understand what happens: from treelib import Tree
train_tree = Tree()
train_tree.create_node("Training", "Training")
summary_tree = Tree()
summary_tree.create_node("MAIN", "Summary")
summary_tree.paste("Summary", train_tree)
summary_tree.show() from termcolor import colored
print(colored("Training", color="green")) print("↗") And everything together from treelib import Tree
from termcolor import colored
train_tree = Tree()
train_tree.create_node(colored("Training ↗", color="green"), "Training")
summary_tree = Tree()
summary_tree.create_node("MAIN", "Summary")
summary_tree.paste("Summary", train_tree)
summary_tree.show() In theory, the last one should fail, and hopefully we can isolate which steps leads to it with the first 3 tests. |
Another thing you can try is to set the environment variable |
Thanks @Louis-Dupont there is no problem with the display of trees, I ran your piece of code successfully. |
Thanks! 🙏 |
it's already UTF-8 |
Hey all! I ran into a similar issue to @T0T4R4 earlier today. I'm running within a similar environment (torch = 1.13.1+cu117, super-gradients=3.1.1, python=3.10.10). I did a bit of tinkering and wanted to share some results, as well as possible workaround for now. First off, I tried setting environment variable PYTHONIOENCONDING = 'utf8' and PYTHONUTF8 = 1 independently, but neither of these seemed to work. I then tried the treelib snippets from @Louis-Dupont. I was able to pass each of these test cases, however, I found that this only worked if I ran them completely separate from the original Then I went to try modifying the source code on my own copy of the super-gradients package. Commenting out To get the function to work without error and with FWIW It appears to me that the encoding is being switched to cp1252 from utf8 somewhere along the way, but it not successfully converted back to utf8 before |
Hi @sewty , you described exactly what we both did ;) and what I think as well happens !! Note that I also tried to change all calls to open a file by specifying the UTF8 encoding, and that didn't make any difference... |
Yea @T0T4R4 its strange that neither setting environment variables nor changing all calls to open a file as you said aren't maintaining the default encoding. To be clear, my final solution did not have At the very end of function display_epoch_summary in sg_trainer_utils.py:
I would give this a try, along with |
ok so my default encoding is actually 1252....
returns For Py 3.10.... I can read "Python opens source files as UTF-8 by default, but any interaction with the filesystem will depend on the environment. It's strongly recommended to use open(filename, encoding='utf-8') to read a file." so my initial approach trying to update all calls to open() to add UTF-8 might be the way... For now I have edited treelib's
Edit: investigating up the 🪜 ladder, moving those 2 lines to |
Ok I'm on this stuff since 2 hours 😅 As soon as the module initializes, it changes the charset to cp1252....
returns
returns ...🤔 |
After having spent so much time in the logging block.... it wasn't there 😅 !! Just found the culprit:
line 30 , must add encoding when opening a file 😁
|
PR pending @Louis-Dupont 🙂 |
@Louis-Dupont 'charmap' codec can't encode characters error is solved. Thanks for the fix. |
@Louis-Dupont , I just ran into the same error. However I do get an error when I run the snippet you provided.
|
@mazatov - pls check
This will give |
Fixed in 3.1.2 |
Hi !
I'm following your tutorial for fine-tuning, but received the following error during training on my GPU :
I tried to just comment the show() function, but at then end of the whole training i got that error :
Environment:
The text was updated successfully, but these errors were encountered: