Skip to content

Commit

Permalink
Allow loading a model using relative path (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
felladrin authored Jun 8, 2024
1 parent 8e5edcb commit fd08e53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/downloader/multi-downloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class MultiDownloads {
async run(): Promise<Blob[]> {
// create all Blobs
await Promise.all(this.tasks.map(async (task) => {
task.blob = await GGUFRemoteBlob.create(new URL(task.url), {
task.blob = await GGUFRemoteBlob.create(task.url, {
logger: this.logger,
useCache: this.useCache,
startSignal: task.signalStart,
Expand Down
6 changes: 3 additions & 3 deletions src/downloader/remote-blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface GGUFRemoteBlobCreateOptions {
}

export class GGUFRemoteBlob extends Blob {
static async create(url: URL, opts?: GGUFRemoteBlobCreateOptions): Promise<Blob> {
static async create(url: RequestInfo | URL, opts?: GGUFRemoteBlobCreateOptions): Promise<Blob> {
const customFetch = opts?.fetch ?? fetch;
const response = await customFetch(url, { method: 'HEAD' });

Expand Down Expand Up @@ -62,7 +62,7 @@ export class GGUFRemoteBlob extends Blob {
}
}

private url: URL;
private url: RequestInfo | URL;
private start: number;
private end: number;
private contentType: string;
Expand All @@ -72,7 +72,7 @@ export class GGUFRemoteBlob extends Blob {
private progressCallback: ProgressCallback;
private startSignal?: Promise<void>;

constructor(url: URL, start: number, end: number, contentType: string, full: boolean, customFetch: typeof fetch, additionals: {
constructor(url: RequestInfo | URL, start: number, end: number, contentType: string, full: boolean, customFetch: typeof fetch, additionals: {
cachedStream?: ReadableStream,
progressCallback: ProgressCallback,
startSignal?: Promise<void>,
Expand Down

0 comments on commit fd08e53

Please sign in to comment.