-
Notifications
You must be signed in to change notification settings - Fork 873
Open
Description
Feature Description
Add API methods to retrieve access request counts (accepted/pending/rejected) without full iteration, optimized for analytics and monitoring use cases.
Context
As discussed in #3591, there's currently no way to get access counts without iterating through all users. For large gated models, this approach is inefficient for common monitoring workflows.
Motivation & Use Cases
Primary Use Cases:
- 📊 Analytics Dashboards: Display current user counts across multiple models
- 📈 Growth Tracking: Monitor daily/weekly user acquisition trends
Example Scenario:
# Current approach - takes 5-10 minutes
for model in my_10_gated_models:
count = sum(1 for _ in api.list_accepted_access_requests(model, "model"))
dashboard.update(model, count)
# Total time: 50-100 minutes for 10 modelsProposed API
Option 1: Stats method with accuracy tradeoff
stats = api.get_access_request_stats(
repo_id="google/gemma-2-2b-it",
repo_type="model",
approximate=True # Allow slightly stale counts for performance
)
# Returns: {
# "accepted": 595174,
# "pending": 1234,
# "rejected": 567,
# "total": 596975,
# "last_updated": "2024-12-05T10:30:00Z" # Cache timestamp
# }Priority
I understand this may not be short-term priority. it would be valuable for the ecosystem. Many organizations building on HF Hub would benefit from this.
Thanks for considering! 🙏
Related: #3591 (where this need was identified)
Metadata
Metadata
Assignees
Labels
No labels