--- license: mit --- # Hub Stats (Lance format) This dataset contains Hugging Face Hub statistics in [Lance](https://github.com/lancedb/lance) format, converted from the original [cfahlgren1/hub-stats](https://huggingface.co/datasets/cfahlgren1/hub-stats) dataset. ## Files - `models.lance` - Statistics for all models on the Hub (~2.5M rows) - `datasets.lance` - Statistics for all datasets on the Hub - `spaces.lance` - Statistics for all spaces on the Hub ## Usage ```python import lance # Load a dataset remotely ds = lance.dataset("hf://datasets/julien-c/hub-stats-lance/datasets.lance") # Convert to pandas df = ds.to_table().to_pandas() # Or query with SQL-like filters table = ds.to_table(filter="downloads > 1000") ``` ### Example: Query datasets by author ```python import lance ds = lance.dataset("hf://datasets/julien-c/hub-stats-lance/datasets.lance") results = ds.to_table(filter="author = 'microsoft'").to_pandas() # Sort by downloads top = results.sort_values("downloads", ascending=False).head(10) print(top[["id", "likes", "downloads"]]) ``` Output: ``` id likes downloads microsoft/ms_marco 221 11120 microsoft/orca-math-word-problems-200k 468 6499 microsoft/bing_coronavirus_query_set 0 6002 microsoft/wiki_qa 69 5737 microsoft/rStar-Coder 225 3492 microsoft/Updesh_beta 8 3223 microsoft/Dayhoff 7 2922 microsoft/meta_woz 6 2801 microsoft/cats_vs_dogs 61 1883 microsoft/IMAGE_UNDERSTANDING 6 1833 ``` ### Example: Vector similarity search ```python import lance import numpy as np ds = lance.dataset("hf://datasets/julien-c/hub-stats-lance/datasets.lance") # Get an embedding to use as query (e.g., from microsoft/ms_marco) query_row = ds.to_table(filter="id = 'microsoft/ms_marco'").to_pandas() query_embedding = np.array(query_row["embedding"].iloc[0]) # Find 10 nearest neighbors results = ds.to_table( nearest={"column": "embedding", "q": query_embedding, "k": 10} ).to_pandas() print(results[["id", "likes", "downloads", "_distance"]]) ``` Output: ``` id likes downloads _distance microsoft/ms_marco 221 11120 2.23 jiwonii97/atalk_as3 0 0 10.61 AI-Art-Collab/ae5 0 1 10.85 wgwgwgwgw/dbbdbbd 0 9 10.90 1FDSFS/56803 0 8 10.94 ``` ## Why Lance? Lance is a modern columnar data format optimized for ML workflows: - Fast random access and filtering - Efficient for large datasets - Native support for vector search - Zero-copy integration with PyArrow/Pandas