Skip to content

Commit f19feec

Browse files
committed
Sync codebase
1 parent 46287bf commit f19feec

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,10 @@ impl CoreBPE {
455455
let decoder: HashMap<usize, Vec<u8>> =
456456
encoder.iter().map(|(k, v)| (*v, k.clone())).collect();
457457

458-
assert!(encoder.len() == decoder.len());
458+
assert!(
459+
encoder.len() == decoder.len(),
460+
"Encoder and decoder must be of equal length; maybe you had duplicate token indices in your encoder?"
461+
);
459462

460463
let special_tokens_decoder: HashMap<usize, Vec<u8>> = special_tokens_encoder
461464
.iter()

tiktoken/load.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def read_file(blobpath: str) -> bytes:
2121
with blobfile.BlobFile(blobpath, "rb") as f:
2222
return f.read()
2323
# avoiding blobfile for public files helps avoid auth issues, like MFA prompts
24-
return requests.get(blobpath).content
24+
resp = requests.get(blobpath)
25+
resp.raise_for_status()
26+
return resp.content
2527

2628

2729
def read_file_cached(blobpath: str) -> bytes:

0 commit comments

Comments
 (0)