Fix reading tokens.txt on Windows (#448)

This commit is contained in:
Fangjun Kuang
2023-11-25 14:22:26 +08:00
committed by GitHub
parent 8444d54c4e
commit 66cad9fa93

View File

@@ -50,6 +50,8 @@ static std::unordered_map<std::string, int32_t> ReadTokens(std::istream &is) {
iss >> id; iss >> id;
} }
// eat the trailing \r\n on windows
iss >> std::ws;
if (!iss.eof()) { if (!iss.eof()) {
SHERPA_ONNX_LOGE("Error: %s", line.c_str()); SHERPA_ONNX_LOGE("Error: %s", line.c_str());
exit(-1); exit(-1);