Add padding to cache key. Fix Safari display issues. Fix 400 on empty translate. Reset bias cache on changing model.

This commit is contained in:
Cohee
2023-08-23 10:32:48 +03:00
parent b385bd190a
commit e77da62b85
7 changed files with 35 additions and 20 deletions

View File

@ -134,7 +134,7 @@ export function getTokenCount(str, padding = undefined) {
const cacheObject = getTokenCacheObject();
const hash = getStringHash(str);
const cacheKey = `${tokenizerType}-${hash}`;
const cacheKey = `${tokenizerType}-${hash}+${padding}`;
if (typeof cacheObject[cacheKey] === 'number') {
return cacheObject[cacheKey];