Skip to content

Commit

Permalink
Fix loading weights whose name is UpperCase
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Oct 4, 2024
1 parent d319c61 commit 1cbc0d1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,5 +292,8 @@ export function toCamelCase(e: string) {
}

export function toSnakeCase(e: string) {
// Do not convert if the first character is upper case.
if (e.length > 0 && e[0] == e[0].toUpperCase())
return e;
return e.replace(/[A-Z]/g, (ch, i) => i ? '_' + ch.toLowerCase() : ch.toLowerCase());
}
}

0 comments on commit 1cbc0d1

Please sign in to comment.