New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gguf updates #543
Gguf updates #543
Conversation
mishig25
commented
Mar 11, 2024
•
edited
edited
- Use length rather than newOffset (discussed here)
- custom fetch fn (discussed here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one suggestion, other than that lgtm, thanks!
packages/gguf/src/gguf.ts
Outdated
@@ -185,8 +188,8 @@ export interface GGUFParseOutput { | |||
tensorInfos: GGUFTensorInfo[]; | |||
} | |||
|
|||
export async function gguf(url: string): Promise<GGUFParseOutput> { | |||
const r = new RangeView(url); | |||
export async function gguf(url: string, _fetch: typeof fetch = fetch): Promise<GGUFParseOutput> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export async function gguf(url: string, _fetch: typeof fetch = fetch): Promise<GGUFParseOutput> { | |
export async function gguf(url: string, params: { | |
/** | |
* Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. | |
*/ | |
fetch?: typeof fetch; | |
}): Promise<GGUFParseOutput> { |
any way to pass it like this for consistency with safetensors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/gguf/src/gguf.ts
Outdated
export async function gguf(url: string): Promise<GGUFParseOutput> { | ||
const r = new RangeView(url); | ||
export async function gguf(url: string, _fetch: typeof fetch = fetch): Promise<GGUFParseOutput> { | ||
const r = new RangeView(url, _fetch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
@@ -223,7 +226,7 @@ export async function gguf(url: string): Promise<GGUFParseOutput> { | |||
throw new Error("Unsupported metadata type: " + valueType); | |||
} | |||
|
|||
let valueResult: { value: MetadataValue; newOffset: number } | undefined; | |||
let valueResult: ReturnType<typeof readMetadataValue> | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍