Generate with CodeXHug: A Dataset to Enhance Model Cards with Code Usage Patterns
摘要
Pre-trained models (PTMs) are becoming increasingly popular in the software engineering community, with repositories like Hugging Face (HF) collecting and maintaining a wide range of these models. However, the actual adoption of PTMs in real-world projects remains an open question, as many models are used in toy projects or simply mirror the HF repository. Additionally, most model cards and related documentation lack explanatory code patterns, making it difficult for newcomers to understand their usage. To address this gap, we present CodeXHug, a curated dataset that includes HF PTMs used in projects stored in the GitHub ecosystem along with their related code usage patterns. The dataset is built by mining the HF repository and the GitHub ecosystem, focusing on PTMs that are characterized by a tag and a model card. We then query the GitHub ecosystem to find actual usages of these PTMs, resulting in a dataset that includes 7,325 different models and 372,063 Python files. The dataset is available on Zenodo and can be used to enhance model cards with code usage patterns, providing concrete examples of how PTMs are used in real-world projects. To the best of our knowledge, CodeXHug is the first dataset that provides a comprehensive overview of PTM usage patterns in real-world projects, enabling researchers and practitioners to better understand how these models are used and how they can be improved.