text
stringlengths
7
328k
id
stringlengths
14
166
metadata
dict
__index_level_0__
int64
0
471
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/utils/check_copies.py/0
{ "file_path": "transformers/utils/check_copies.py", "repo_id": "transformers", "token_count": 22672 }
404
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging logger = logging.get_logger(__name__) def extract_warnings_from_single_artifact(artifact_path, targets): """Extract warnings from a downl...
transformers/utils/extract_warnings.py/0
{ "file_path": "transformers/utils/extract_warnings.py", "repo_id": "transformers", "token_count": 2110 }
405
from transformers import PretrainedConfig class CustomConfig(PretrainedConfig): model_type = "custom" def __init__(self, attribute=1, **kwargs): self.attribute = attribute super().__init__(**kwargs) class NoSuperInitConfig(PretrainedConfig): model_type = "custom" def __init__(self,...
transformers/utils/test_module/custom_configuration.py/0
{ "file_path": "transformers/utils/test_module/custom_configuration.py", "repo_id": "transformers", "token_count": 136 }
406
import json import os from ghapi.all import GhApi FOLDER_STRING = os.environ.get("FOLDER_STRING", "") folder = f"benchmark/trl/{FOLDER_STRING}" host_url = f"https://huggingface.co/datasets/trl-internal-testing/example-images/resolve/main/images/benchmark/{FOLDER_STRING}" # Create a GitHub API instance github_contex...
trl/benchmark/post_github_comment.py/0
{ "file_path": "trl/benchmark/post_github_comment.py", "repo_id": "trl", "token_count": 358 }
407
# DPO Trainer TRL supports the DPO Trainer for training language models from preference data, as described in the paper [Direct Preference Optimization: Your Language Model is Secretly a Reward Model](https://arxiv.org/abs/2305.18290) by Rafailov et al., 2023. For a full example have a look at [`examples/scripts/dpo....
trl/docs/source/dpo_trainer.mdx/0
{ "file_path": "trl/docs/source/dpo_trainer.mdx", "repo_id": "trl", "token_count": 3902 }
408
# Sentiment Tuning Examples The notebooks and scripts in this examples show how to fine-tune a model with a sentiment classifier (such as `lvwerra/distilbert-imdb`). Here's an overview of the notebooks and scripts in the [trl repository](https://github.com/huggingface/trl/tree/main/examples): | File ...
trl/docs/source/sentiment_tuning.mdx/0
{ "file_path": "trl/docs/source/sentiment_tuning.mdx", "repo_id": "trl", "token_count": 2400 }
409
# 0. imports import torch from transformers import GPT2Tokenizer from trl import AutoModelForCausalLMWithValueHead, PPOConfig, PPOTrainer # 1. load a pretrained model model = AutoModelForCausalLMWithValueHead.from_pretrained("gpt2") model_ref = AutoModelForCausalLMWithValueHead.from_pretrained("gpt2") tokenizer = GP...
trl/examples/hello_world.py/0
{ "file_path": "trl/examples/hello_world.py", "repo_id": "trl", "token_count": 501 }
410
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
trl/examples/research_projects/tools/python_interpreter.py/0
{ "file_path": "trl/examples/research_projects/tools/python_interpreter.py", "repo_id": "trl", "token_count": 2604 }
411
[tool.ruff] target-version = "py37" line-length = 119 [tool.ruff.lint] ignore = [ "B028", # warning without explicit stacklevel "C408", # dict() calls (stylistic) "C901", # function complexity "E501", ] extend-select = ["E", "F", "I", "W", "UP", "B", "T", "C"] [tool.ruff.lint.per-file-ignores] # Allow...
trl/pyproject.toml/0
{ "file_path": "trl/pyproject.toml", "repo_id": "trl", "token_count": 211 }
412
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
trl/tests/test_data_collator_completion_only.py/0
{ "file_path": "trl/tests/test_data_collator_completion_only.py", "repo_id": "trl", "token_count": 1973 }
413
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
trl/trl/models/modeling_value_head.py/0
{ "file_path": "trl/trl/models/modeling_value_head.py", "repo_id": "trl", "token_count": 8183 }
414
# Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
trl/trl/trainer/ppo_config.py/0
{ "file_path": "trl/trl/trainer/ppo_config.py", "repo_id": "trl", "token_count": 2849 }
415