lonePatient / BERT-NER-Pytorch

Chinese NER(Named Entity Recognition) using BERT(Softmax, CRF, Span)
MIT License
2.08k stars 427 forks source link

when it runs on windows, it occurs " OSError: [Errno 22] " #52

Closed lvjiujin closed 3 years ago

lvjiujin commented 3 years ago

init_logger(log_file=args.output_dir + f'/{args.model_type}-{args.task_name}-{time_}.log')

this line code in the run_ner_crf.py file, how to solves it ? a simple method is like the following: init_logger(log_file=args.output_dir + r'/{args.model_type}-{args.task_name}-{time_}.log')

but the file name will become "{args.model_type}-{args.taskname}-{time}.log"

I think I know the reason, "You are on windows that uses backslash as path separator . However for python this is escape char, so you need to use forward slash or raw string or escape the backslash. change these types of addresses:" in the OSError: [Errno 22]

but I tried selves times to solve this problem , I failed and took 3 hours , who can tell me how to solve it?

wsnra commented 3 years ago

一样的问题,请问解决了吗

chenyumiyu commented 3 years ago

@lvjiujin @875691601 这是因为windowns不支持文件路径中的“:”符号,你将文件地址中的":"改成其他的就可以了

lvjiujin commented 3 years ago

@lvjiujin @875691601 这是因为windowns不支持文件路径中的“:”符号,你将文件地址中的":"改成其他的就可以了

嗯嗯,之前有朋友帮忙解决了,确实是这样的,忘记过来看了,多谢多谢。