-
Notifications
You must be signed in to change notification settings - Fork 533
Closed
Description
THe modelInfo
method is allowing the caller to define which field will be provided, it has been added in #946
huggingface.js/packages/hub/src/lib/model-info.ts
Lines 9 to 11 in 186ab73
export async function modelInfo< | |
const T extends Exclude<(typeof MODEL_EXPANDABLE_KEYS)[number], (typeof MODEL_EXPANDABLE_KEYS)[number]> = never, | |
>( |
Here is an example
$: const info = await modelInfo({
name: "openai-community/gpt2",
});
$: console.log(info);
{
id: '621ffdc036468d709f17434d',
name: 'openai-community/gpt2',
private: false,
task: 'text-generation',
downloads: 13764131,
gated: false,
likes: 2334,
updatedAt: 2024-02-19T10:57:45.000Z
}
We can ask for additional fields, using the additionalFields
. Here is an example
$: const info = await modelInfo({
name: "openai-community/gpt2",
additionalFields: ['author'],
});
$: console.log(info);
{
// ... omitted
author: 'openai-community',
}
However I am not able to find proper typing for the method calling and return type.
The return type of modelInfo
is the following
): Promise<ModelEntry & Pick<ApiModelInfo, T>> { |
The additionalFields is the following
additionalFields?: T[]; |
But, I am getting an error when doing the following
const info = await modelInfo<'author'>({
name: "openai-community/gpt2",
additionalFields: ['author'],
});
TS2344: Type string does not satisfy the constraint never
I am also interesting in getting the full ApiModelInfo
object, but I am not able to use the method with the right typing 🤔 .
cc @coyotte508 :)
Metadata
Metadata
Assignees
Labels
No labels