-
Notifications
You must be signed in to change notification settings - Fork 8
Add inference providers details #37
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
Open
aymeric-roucher
wants to merge
5
commits into
evalstate:main
Choose a base branch
from
aymeric-roucher:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+55
−1
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
aaa8ae8
Add inference providers details
aymeric-roucher 207121d
Remove second HTTP call
aymeric-roucher 6af41b9
Improve and test formatting
aymeric-roucher dc7ca5f
Put Inference provider details at the bottom
aymeric-roucher 1feb076
Merge remote-tracking branch 'origin/main' into pr/aymeric-roucher/37
evalstate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||||||||||||||||
import { z } from 'zod'; | ||||||||||||||||||||
import { modelInfo } from '@huggingface/hub'; | ||||||||||||||||||||
import { z } from 'zod'; | ||||||||||||||||||||
import { formatDate, formatNumber } from './utilities.js'; | ||||||||||||||||||||
|
||||||||||||||||||||
const SPACES_TO_INCLUDE = 12; | ||||||||||||||||||||
|
@@ -58,11 +58,20 @@ interface ModelMetadata { | |||||||||||||||||||
fineTunedFrom?: string; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
// Inference providers information | ||||||||||||||||||||
interface InferenceProvider { | ||||||||||||||||||||
provider: string; | ||||||||||||||||||||
status?: string; | ||||||||||||||||||||
providerId?: string; | ||||||||||||||||||||
task?: string; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
// Complete model information structure | ||||||||||||||||||||
interface ModelInformation extends ModelBasicInfo { | ||||||||||||||||||||
extended?: ModelExtendedInfo; | ||||||||||||||||||||
technical?: ModelTechnicalDetails; | ||||||||||||||||||||
metadata?: ModelMetadata; | ||||||||||||||||||||
inferenceProviders?: InferenceProvider[]; | ||||||||||||||||||||
spaces?: Array<{ | ||||||||||||||||||||
id: string; | ||||||||||||||||||||
name: string; | ||||||||||||||||||||
|
@@ -87,6 +96,7 @@ export class ModelDetailTool { | |||||||||||||||||||
this.hubUrl = hubUrl; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
/** | ||||||||||||||||||||
* Get detailed information about a specific model | ||||||||||||||||||||
* | ||||||||||||||||||||
|
@@ -106,6 +116,7 @@ export class ModelDetailTool { | |||||||||||||||||||
'safetensors', | ||||||||||||||||||||
'cardData', | ||||||||||||||||||||
'spaces', | ||||||||||||||||||||
'inferenceProviderMapping', | ||||||||||||||||||||
] as const; | ||||||||||||||||||||
|
||||||||||||||||||||
const modelData = await modelInfo<(typeof additionalFields)[number]>({ | ||||||||||||||||||||
|
@@ -115,6 +126,18 @@ export class ModelDetailTool { | |||||||||||||||||||
...(this.hubUrl && { hubUrl: this.hubUrl }), | ||||||||||||||||||||
}); | ||||||||||||||||||||
|
||||||||||||||||||||
// Extract inference providers from modelData if available | ||||||||||||||||||||
let inferenceProviders: InferenceProvider[] | undefined; | ||||||||||||||||||||
|
||||||||||||||||||||
if (modelData.inferenceProviderMapping && typeof modelData.inferenceProviderMapping === 'object') { | ||||||||||||||||||||
inferenceProviders = Object.entries(modelData.inferenceProviderMapping).map(([providerName, providerData]: [string, any]) => ({ | ||||||||||||||||||||
provider: providerName, | ||||||||||||||||||||
status: providerData.status, | ||||||||||||||||||||
providerId: providerData.providerId, | ||||||||||||||||||||
task: providerData.task, | ||||||||||||||||||||
})); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
// Build the structured model information | ||||||||||||||||||||
const modelDetails: ModelInformation = { | ||||||||||||||||||||
// Basic info (required fields) | ||||||||||||||||||||
|
@@ -134,6 +157,9 @@ export class ModelDetailTool { | |||||||||||||||||||
downloadsAllTime: modelData.downloadsAllTime, | ||||||||||||||||||||
tags: modelData.tags, | ||||||||||||||||||||
}, | ||||||||||||||||||||
|
||||||||||||||||||||
// Inference providers (if available) | ||||||||||||||||||||
...(inferenceProviders && inferenceProviders.length > 0 && { inferenceProviders }), | ||||||||||||||||||||
}; | ||||||||||||||||||||
|
||||||||||||||||||||
// Technical details (requires validation) | ||||||||||||||||||||
|
@@ -352,6 +378,34 @@ function formatModelDetails(model: ModelInformation): string { | |||||||||||||||||||
r.push(''); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
// Inference Providers - if available | ||||||||||||||||||||
if (model.inferenceProviders && model.inferenceProviders.length > 0) { | ||||||||||||||||||||
r.push('## Inference Providers'); | ||||||||||||||||||||
console.log('DEBUG: inferenceProviders:', model.inferenceProviders); | ||||||||||||||||||||
|
||||||||||||||||||||
for (const provider of model.inferenceProviders) { | ||||||||||||||||||||
let providerLine = `- **${provider.provider}**`; | ||||||||||||||||||||
|
||||||||||||||||||||
// Add status if available | ||||||||||||||||||||
if (provider.status) { | ||||||||||||||||||||
providerLine += ` (${provider.status})`; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
// Add provider ID if available | ||||||||||||||||||||
if (provider.providerId) { | ||||||||||||||||||||
providerLine += ` | Provider ID: ${provider.providerId}`; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
// Add task if available | ||||||||||||||||||||
if (provider.task) { | ||||||||||||||||||||
providerLine += ` | Task: ${provider.task}`; | ||||||||||||||||||||
} | ||||||||||||||||||||
Comment on lines
+394
to
+402
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
i'd remove all this |
||||||||||||||||||||
r.push(providerLine); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
r.push(''); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
// Link is reliable - based on model name which is required | ||||||||||||||||||||
r.push(`**Link:** [https://hf.co/${model.name}](https://hf.co/${model.name})`); | ||||||||||||||||||||
|
||||||||||||||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
i'll move the logging utility to a shared package (amongst other build improvements) and remove the console.log when ready to merge