fix: failed to download tokernizer from HF (#1060)

This commit is contained in:
Yang Jun 2025-01-09 18:09:33 +08:00 committed by GitHub
parent 225e6f9572
commit 6c10081899
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -71,7 +71,9 @@ impl HuggingFaceTokenizer {
if !cached_path.exists() {
let response = ureq::get(url).call().unwrap();
let _ = std::fs::write(&cached_path, response.into_string().unwrap());
let mut file = std::fs::File::create(&cached_path).unwrap();
let mut reader = response.into_reader();
std::io::copy(&mut reader, &mut file).unwrap();
}
cached_path
}