transformers: Instructions file for GitHub Copilot

.github/copilot-instructions.md

transformers copilot-instructions.md is an instructions file for GitHub Copilot from huggingface/transformers. It costs 773 tokens per session, scanned A, original, Apache-2.0.

Repository instructions for Hugging Face Transformers, a software library for working with machine-learning models that process text and other data.

In plain words
What is it for?
Planning edits to model implementations, adding or updating tests, and working with the library's documentation and source layout.
Why use it?
They explain where model code, tests, and documentation belong and help keep changes aligned with the project's coding and testing practices.

Instructions file for GitHub Copilot ✓ vendor

Written for GitHub Copilot: a Copilot instructions file.

This is huggingface/transformers's own configuration. It tells GitHub Copilot how to work on transformers itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything transformers configures →

About the project

Hugging Face Transformers is a framework that defines machine-learning models for text, vision, audio, video, and multimodal data, supporting both training and inference. Developers use it to work with pretrained models and connect them to training frameworks, inference engines, and other modeling libraries. The catalogue add-ons provide instructions and a skill for working with Transformers.

huggingface/transformers · 168,576 stars · on GitHub · huggingface.co

Reuse

Borrowing it

Nothing to install: this file belongs to huggingface/transformers. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/huggingface/transformers/main/.github/copilot-instructions.md
Clone the repo
git clone --depth 1 https://github.com/huggingface/transformers

Made for: GitHub Copilot.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for transformers copilot-instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/huggingface/transformers/copilot-instructions/github.svg)](https://agentmods.dev/instructions/huggingface/transformers/copilot-instructions)
Your own site
<a href="https://agentmods.dev/instructions/huggingface/transformers/copilot-instructions"><img src="https://agentmods.dev/badge/instructions/huggingface/transformers/copilot-instructions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for transformers copilot-instructions.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/huggingface/transformers/copilot-instructions"><img src="https://agentmods.dev/badge/instructions/huggingface/transformers/copilot-instructions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 773 This file is loaded in full into every session.
When invoked 773 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00773 $0.00773
Opus 5.5 $0.00309 $0.00309
Sonnet 5.5 $0.00155 $0.00155
Haiku 4.5 $0.00077 $0.00077

Measured 2mo ago against content hash 51d12faef435, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

transformers copilot-instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/copilot-instructions.md · 40 lines

How it starts

The opening of the file, as written. The whole thing — 40 lines — stays where its author put it; the contents beside it link to each section on GitHub.

copilot-instructions.md Guide for Hugging Face Transformers

This copilot-instructions.md file provides guidance for code agents working with this codebase.

Core Project Structure

  • /src/transformers: This contains the core source code for the library
    • /models: Code for individual models. Models inherit from base classes in the root /src/transformers directory.
  • /tests: This contains the core test classes for the library. These are usually inherited rather than directly run.
    • /models: Tests for individual models. Model tests inherit from common tests in the root /tests directory.
  • /docs: This contains the documentation for the library, including guides, tutorials, and API references.

Coding Conventions for Hugging Face Transformers

  • PRs should be as brief as possible. Bugfix PRs in particular can often be only one or two lines long, and do not need large comments, docstrings or new functions in this case. Aim to minimize the size of the diff.
  • When writing tests, they should be added to an existing file. The only exception is for PRs to add a new model, when a new test directory should be created for that model.
  • Code style is enforced in the CI. You can install the style tools with pip install -e .[quality]. You can then run make fixup to apply style and consistency fixes to your code.

Copying and inheritance

Many models in the codebase have similar code, but it is not shared by inheritance because we want each model file to be self-contained. We use two mechanisms to keep this code in sync:

  • "Copied from" syntax. Functions or entire classes can have a comment at the top like this: # Copied from transformers.models.llama.modeling_llama.rotate_half or # Copied from transformers.models.t5.modeling_t5.T5LayerNorm with T5->MT5 These comments are actively checked by the style tools, and copies will automatically be updated when the base code is updated. If you need to update a copied function, you should either update the base function and use make fixup to propagate the change to all copies, or simply remove the # Copied from comment if that is inappropriate.
  • "Modular" files. These files briefly define models by composing them using inheritance from other models. They are not meant to be used directly. Instead, the style tools automatically generate a complete modeling file, like modeling_bert.py, from the modular file like modular_bert.py. If a model has a modular file, the modeling file should never be edited directly! Instead, changes should be made in the modular file, and then you should run make fixup to update the modeling file automatically.

Read the full file on GitHub · 40 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 40 lines · 773 tokens per session scan A 51d12faef435

Subscribe to this mod's changes

transformers copilot-instructions.md is an instructions file published in the GitHub repository huggingface/transformers (168,576 stars, last pushed today), licensed Apache-2.0. It adds 773 tokens to every session, about $0.0031 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

transformers copilot-instructions.md compared with instructions from other repositories

transformers copilot-instructions.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
transformers copilot-instructions.mdhuggingface/transformersInstructions file169ktodayApache-2.0A773GitHub Copilot
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode