Megvii-BaseDetection / Megvii-BaseDetection/YOLOX

train log output error 编码问题

Open
#694 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

2021-09-14 10:10:08 | INFO | yolox.core.trainer:127 - exp value:
\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555
\u2502 keys \u2502 values \u2502
\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561
\u2502 seed \u2502 None \u2502
\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524
\u2502 output_dir \u2502 './YOLOX_outputs' \u2502
\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524
\u2502 print_interval \u2502 10 \u2502
\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524
\u2502 eval_interval \u2502 10 \u2502
\u2502 weight_decay \u2502 0.0005 \u2502\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524
\u2502 momentum \u2502 0.9 \u2502\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524
\u2502 exp_name \u2502 'yolox_s_dorsum' \u2502\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524
\u2502 test_size \u2502 (640, 640) \u2502\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524
\u2502 test_conf \u2502 0.01 \u2502\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524
\u2502 nmsthre \u2502 0.65 \u2502\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b
2021-09-14 10:10:08 | ERROR | yolox.core.launch:147 - An error has been caught in function '_distributed_worker', process 'SpawnProcess-1' (25321), thread 'MainThread' (140486510868288):
Traceback (most recent call last):

File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/site-packages/loguru/_handler.py", line 177, in emit
self._sink.write(str_record)
| | | -> "2021-09-14 10:10:08.710 | INFO | yolox.core.trainer:before_train:127 - exp value:\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550...
| | -> <function FileSink.write at 0x7fc58ee7ea60>
| -> <loguru._file_sink.FileSink object at 0x7fc457d68da0>
-> (id=2, level=10, sink='./YOLOX_outputs/yolox_s_dorsum/train_log.txt')
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/site-packages/loguru/_file_sink.py", line 176, in write
self._file.write(message)
| | | -> "2021-09-14 10:10:08.710 | INFO | yolox.core.trainer:before_train:127 - exp value:\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550...
| | -> <method 'write' of '_io.TextIOWrapper' objects>
| -> <_io.TextIOWrapper name='/home/duxiaogang/workplace/YOLOX/YOLOX_outputs/yolox_s_dorsum/train_log.txt' mode='a' encoding='ANSI...
-> <loguru._file_sink.FileSink object at 0x7fc457d68da0>

UnicodeEncodeError: 'ascii' codec can't encode characters in position 86-125: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "", line 1, in
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/multiprocessing/spawn.py", line 105, in spawn_main
exitcode = _main(fd)
| -> 10
-> <function _main at 0x7fc58f64ac80>
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/multiprocessing/spawn.py", line 118, in _main
return self._bootstrap()
| -> <function BaseProcess._bootstrap at 0x7fc58f7536a8>
-> <SpawnProcess(SpawnProcess-1, started)>
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
| -> <function BaseProcess.run at 0x7fc58f745e18>
-> <SpawnProcess(SpawnProcess-1, started)>
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
| | | | | -> {}
| | | | -> <SpawnProcess(SpawnProcess-1, started)>
| | | -> (<function _distributed_worker at 0x7fc4635edb70>, 0, (<function main at 0x7fc457d45620>, 2, 2, 0, 'nccl', 'tcp://127.0.0.1:3...
| | -> <SpawnProcess(SpawnProcess-1, started)>
| -> <function _wrap at 0x7fc4669f96a8>
-> <SpawnProcess(SpawnProcess-1, started)>
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 59, in _wrap
fn(i, *args)
| | -> (<function main at 0x7fc457d45620>, 2, 2, 0, 'nccl', 'tcp://127.0.0.1:39499', (\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555
| | \u2502 key...
| -> 0
-> <function _distributed_worker at 0x7fc4635edb70>

File "/home/duxiaogang/workplace/YOLOX/yolox/core/launch.py", line 147, in _distributed_worker
main_func(*args)
| -> (\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555
| \u2502 keys \u2502 values \u2502
| \u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561
| \u2502...
-> <function main at 0x7fc457d45620>

File "/home/duxiaogang/workplace/YOLOX/tools/train.py", line 110, in main
trainer.train()
| -> <function Trainer.train at 0x7fc4597019d8>
-> <yolox.core.trainer.Trainer object at 0x7fc457d52ef0>

File "/home/duxiaogang/workplace/YOLOX/yolox/core/trainer.py", line 70, in train
self.before_train()
| -> <function Trainer.before_train at 0x7fc45802cbf8>
-> <yolox.core.trainer.Trainer object at 0x7fc457d52ef0>

File "/home/duxiaogang/workplace/YOLOX/yolox/core/trainer.py", line 127, in before_train
logger.info("exp value:\n{}".format(self.exp))
| | | -> \u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555
| | | \u2502 keys \u2502 values \u2502
| | | \u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561
| | | \u2502 ...
| | -> <yolox.core.trainer.Trainer object at 0x7fc457d52ef0>
| -> <function Logger.info at 0x7fc58eac99d8>
-> <loguru.logger handlers=[(id=1, level=20, sink=), (id=2, level=10, sink='./YOLOX_outputs/yolox_s_dorsum/train_log.txt...

File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/site-packages/loguru/_handler.py", line 182, in emit
self._error_interceptor.print(record)
| | | -> {'elapsed': datetime.timedelta(0, 4, 609508), 'exception': None, 'extra': {}, 'file': (name='trainer.py', path='/home/duxiaog...
| | -> <function ErrorInterceptor.print at 0x7fc58ee6dd08>
| -> <loguru._error_interceptor.ErrorInterceptor object at 0x7fc457d68d68>
-> (id=2, level=10, sink='./YOLOX_outputs/yolox_s_dorsum/train_log.txt')
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/site-packages/loguru/_error_interceptor.py", line 28, in print
sys.stderr.write("Record was: %s\n" % record_repr)
| | | -> '{'elapsed': datetime.timedelta(0, 4, 609508), 'exception': None, 'extra': {}, 'file': (name='trainer.py', path='/...
| | -> <function StreamToLoguru.write at 0x7fc46585b488>
| -> <yolox.utils.logger.StreamToLoguru object at 0x7fc457cfe198>
-> <module 'sys' (built-in)>

File "/home/duxiaogang/workplace/YOLOX/yolox/utils/logger.py", line 51, in write
sys.stdout.write(buf)
| | | -> 'Record was: {'elapsed': datetime.timedelta(0, 4, 609508), 'exception': None, 'extra': {}, 'file': (name='trainer.py...
| | -> <method 'write' of '_io.TextIOWrapper' objects>
| -> <_io.TextIOWrapper name='' mode='w' encoding='ANSI_X3.4-1968'>
-> <module 'sys' (built-in)>

UnicodeEncodeError: 'ascii' codec can't encode characters in position 246-247: ordinal not in range(128)
--- Logging error in Loguru Handler #2 ---
Traceback (most recent call last):
File "tools/train.py", line 132, in
args=(exp, args),
File "/home/duxiaogang/workplace/YOLOX/yolox/core/launch.py", line 95, in launch
start_method=start_method,
fn(i, *args) File "/home/duxiaogang/workplace/YOLOX/yolox/core/launch.py", line 147, in _distributed_worker
main_func(*args) File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/site-packages/loguru/_logger.py", line 1220, in catch_wrapper
return function(*args, **kwargs)
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/site-packages/loguru/_logger.py", line 1192, in exit
self._log(level_id, static_level_no, from_decorator, catch_options, message, (), {})
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/site-packages/loguru/_logger.py", line 1959, in _log
handler.emit(log_record, level_id, from_decorator, raw, colored_message)
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/site-packages/loguru/_handler.py", line 182, in emit
self._error_interceptor.print(record)
File "/home/duxiaogang/anaconda3/envs/yolox/lib/python3.6/site-packages/loguru/_error_interceptor.py", line 28, in print
sys.stderr.write("Record was: %s\n" % record_repr)
File "/home/duxiaogang/workplace/YOLOX/yolox/utils/logger.py", line 51, in write
sys.stdout.write(buf)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 409-410: ordinal not in range(128)

请求帮助,谢谢!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at tools/train.py and follow the call into yolox/core/trainer.py line 127, where the experiment value is logged. Inspect yolox/utils/logger.py line 51 and reproduce the non-ASCII output case shown in the traceback. Done means training can write this log output without a UnicodeEncodeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.