sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
huggingface/peft:src/peft/tuners/cartridge/config.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/cartridge/config.py", "license": "Apache License 2.0", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/cartridge/model.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/cartridge/model.py", "license": "Apache License 2.0", "lines": 95, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/cartridge/utils.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/cartridge/utils.py", "license": "Apache License 2.0", "lines": 207, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:tests/test_cartridge.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "tests/test_cartridge.py", "license": "Apache License 2.0", "lines": 218, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/peft:examples/bdlora_finetuning/chat.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "examples/bdlora_finetuning/chat.py", "license": "Apache License 2.0", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:examples/gralora_finetuning/gralora_finetuning.py
# This script is based on examples/dora_finetuning/dora_finetuning.py import os import torch from datasets import load_dataset from transformers import ( AutoModelForCausalLM, AutoTokenizer, DataCollatorForLanguageModeling, Trainer, TrainingArguments, ) from peft import GraloraConfig, get_peft_mod...
{ "repo_id": "huggingface/peft", "file_path": "examples/gralora_finetuning/gralora_finetuning.py", "license": "Apache License 2.0", "lines": 167, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/peft:src/peft/tuners/gralora/config.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/gralora/config.py", "license": "Apache License 2.0", "lines": 175, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/gralora/layer.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/gralora/layer.py", "license": "Apache License 2.0", "lines": 329, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/gralora/model.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/gralora/model.py", "license": "Apache License 2.0", "lines": 121, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/osf/config.py
from __future__ import annotations from dataclasses import dataclass, field from typing import Optional, Union from peft.config import PeftConfig from peft.utils import PeftType @dataclass class OSFConfig(PeftConfig): """ Configuration for Orthogonal Subspace Fine-tuning (OSF). Args: effective_...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/osf/config.py", "license": "Apache License 2.0", "lines": 72, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
huggingface/peft:src/peft/tuners/osf/layer.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/osf/layer.py", "license": "Apache License 2.0", "lines": 243, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/osf/model.py
from __future__ import annotations import re import torch import torch.nn as nn from peft.tuners.tuners_utils import BaseTuner from peft.utils.constants import TRANSFORMERS_MODELS_TO_OSF_TARGET_MODULES_MAPPING from .layer import OSFLayer, dispatch_default class OSFModel(BaseTuner): """A minimal tuner implemen...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/osf/model.py", "license": "Apache License 2.0", "lines": 104, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/peft:src/peft/tuners/osf/utils.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/osf/utils.py", "license": "Apache License 2.0", "lines": 108, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:tests/test_osf.py
import pytest import torch from torch.testing import assert_close from peft import OSFConfig, get_peft_model from peft.tuners.osf.layer import OSFLayer from peft.tuners.osf.utils import ( decompose_weight_matrix, reconstruct_weight_matrix, ) def test_osf_roundtrip(): w = torch.randn(10, 8) svd = deco...
{ "repo_id": "huggingface/peft", "file_path": "tests/test_osf.py", "license": "Apache License 2.0", "lines": 57, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/peft:examples/delora_finetuning/delora_finetuning.py
# This script is based on examples/randlora_finetuning/randlora_finetuning.py import os import torch from datasets import load_dataset from transformers import ( AutoModelForCausalLM, AutoTokenizer, DataCollatorForLanguageModeling, Trainer, TrainingArguments, ) from peft import DeloraConfig, get_p...
{ "repo_id": "huggingface/peft", "file_path": "examples/delora_finetuning/delora_finetuning.py", "license": "Apache License 2.0", "lines": 162, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/peft:src/peft/tuners/delora/config.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/delora/config.py", "license": "Apache License 2.0", "lines": 146, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/delora/layer.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/delora/layer.py", "license": "Apache License 2.0", "lines": 230, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/delora/model.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/delora/model.py", "license": "Apache License 2.0", "lines": 85, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:examples/waveft_finetuning/waveft_finetuning.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "examples/waveft_finetuning/waveft_finetuning.py", "license": "Apache License 2.0", "lines": 165, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/waveft/config.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/waveft/config.py", "license": "Apache License 2.0", "lines": 254, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/waveft/constants.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/waveft/constants.py", "license": "Apache License 2.0", "lines": 95, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/waveft/layer.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/waveft/layer.py", "license": "Apache License 2.0", "lines": 252, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/waveft/model.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/waveft/model.py", "license": "Apache License 2.0", "lines": 170, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/waveft/waverec2d.py
# Copyright 2021 Moritz Wolter # Copyright 2025-present the HuggingFace Inc. team. # # Licensed under the EUPL v1.2 # # This file contains code derived from PyTorch-Wavelet-Toolbox: # https://github.com/v0lta/PyTorch-Wavelet-Toolbox # # Original work by Moritz Wolter, licensed under EUPL v1.2 # Modifications and integr...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/waveft/waverec2d.py", "license": "Apache License 2.0", "lines": 254, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/functional.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/functional.py", "license": "Apache License 2.0", "lines": 30, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:examples/arrow_multitask/arrow_phi3_mini.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "examples/arrow_multitask/arrow_phi3_mini.py", "license": "Apache License 2.0", "lines": 319, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/lora/arrow.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/lora/arrow.py", "license": "Apache License 2.0", "lines": 394, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:tests/test_arrow.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "tests/test_arrow.py", "license": "Apache License 2.0", "lines": 432, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/peft:examples/alora_finetuning/alora_finetuning.py
import os import torch from datasets import load_dataset from transformers import ( AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, DataCollatorForLanguageModeling, Trainer, TrainingArguments, ) from peft import LoraConfig, PeftModel, get_peft_model, prepare_model_for_kbit_training ...
{ "repo_id": "huggingface/peft", "file_path": "examples/alora_finetuning/alora_finetuning.py", "license": "Apache License 2.0", "lines": 228, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/peft:examples/road_finetuning/road_finetuning.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "examples/road_finetuning/road_finetuning.py", "license": "Apache License 2.0", "lines": 180, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/road/bnb.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/road/bnb.py", "license": "Apache License 2.0", "lines": 340, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/road/config.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/road/config.py", "license": "Apache License 2.0", "lines": 116, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/road/layer.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/road/layer.py", "license": "Apache License 2.0", "lines": 342, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/road/model.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/road/model.py", "license": "Apache License 2.0", "lines": 135, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/utils/warning.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/utils/warning.py", "license": "Apache License 2.0", "lines": 15, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:method_comparison/text_generation_benchmark/data.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "method_comparison/text_generation_benchmark/data.py", "license": "Apache License 2.0", "lines": 93, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:method_comparison/text_generation_benchmark/run.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "method_comparison/text_generation_benchmark/run.py", "license": "Apache License 2.0", "lines": 298, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:method_comparison/text_generation_benchmark/run_base.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "method_comparison/text_generation_benchmark/run_base.py", "license": "Apache License 2.0", "lines": 148, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:method_comparison/text_generation_benchmark/utils.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "method_comparison/text_generation_benchmark/utils.py", "license": "Apache License 2.0", "lines": 376, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:examples/miss_finetuning/miss_finetuning.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "examples/miss_finetuning/miss_finetuning.py", "license": "Apache License 2.0", "lines": 93, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:scripts/convert-bone-to-miss.py
#!/usr/bin/env python3 # Copyright (c) 2025 Your Organization/Project. 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 ...
{ "repo_id": "huggingface/peft", "file_path": "scripts/convert-bone-to-miss.py", "license": "Apache License 2.0", "lines": 52, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/miss/config.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/miss/config.py", "license": "Apache License 2.0", "lines": 131, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/miss/layer.py
# Copyright 2024-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/miss/layer.py", "license": "Apache License 2.0", "lines": 338, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/miss/model.py
# Copyright 2024-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/miss/model.py", "license": "Apache License 2.0", "lines": 111, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:tests/test_target_parameters.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "tests/test_target_parameters.py", "license": "Apache License 2.0", "lines": 511, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/peft:examples/shira_finetuning/shira_finetuning.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "examples/shira_finetuning/shira_finetuning.py", "license": "Apache License 2.0", "lines": 188, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/shira/config.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/shira/config.py", "license": "Apache License 2.0", "lines": 120, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/shira/layer.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/shira/layer.py", "license": "Apache License 2.0", "lines": 185, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/shira/mask_functions.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/shira/mask_functions.py", "license": "Apache License 2.0", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/shira/model.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/shira/model.py", "license": "Apache License 2.0", "lines": 117, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:tests/test_shira.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "tests/test_shira.py", "license": "Apache License 2.0", "lines": 221, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/peft:src/peft/tuners/c3a/config.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/c3a/config.py", "license": "Apache License 2.0", "lines": 128, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/c3a/layer.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/c3a/layer.py", "license": "Apache License 2.0", "lines": 175, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/c3a/model.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/c3a/model.py", "license": "Apache License 2.0", "lines": 84, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/c3a/utils.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/c3a/utils.py", "license": "Apache License 2.0", "lines": 43, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/oft/aqlm.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/oft/aqlm.py", "license": "Apache License 2.0", "lines": 86, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/oft/awq.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/oft/awq.py", "license": "Apache License 2.0", "lines": 89, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/oft/bnb.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/oft/bnb.py", "license": "Apache License 2.0", "lines": 321, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/oft/eetq.py
# Copyright 2024-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/oft/eetq.py", "license": "Apache License 2.0", "lines": 95, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/oft/gptq.py
# Copyright 2023-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/oft/gptq.py", "license": "Apache License 2.0", "lines": 89, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/oft/hqq.py
# Copyright 2024-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/oft/hqq.py", "license": "Apache License 2.0", "lines": 152, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:src/peft/tuners/oft/inc.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "src/peft/tuners/oft/inc.py", "license": "Apache License 2.0", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/peft:examples/qalora_finetuning/qalora_gptq_finetuning.py
#!/usr/bin/env python3 """ Training script for fine-tuning language models with QALoRA using GPTQ quantization. This script supports cached quantization to avoid repeating expensive quantization processes. """ import argparse import os import torch from datasets import load_dataset from transformers import ( Auto...
{ "repo_id": "huggingface/peft", "file_path": "examples/qalora_finetuning/qalora_gptq_finetuning.py", "license": "Apache License 2.0", "lines": 303, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/peft:method_comparison/test_sanitizer.py
import pandas as pd import pytest from .sanitizer import parse_and_filter @pytest.fixture def df_products(): data = { 'product_id': [101, 102, 103, 104, 105, 106], 'category': ['Electronics', 'Books', 'Electronics', 'Home Goods', 'Books', 'Electronics'], 'price': [799.99, 19.99, 49.50, 12...
{ "repo_id": "huggingface/peft", "file_path": "method_comparison/test_sanitizer.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/peft:tests/test_lora_variants.py
# Copyright 2025-present 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 law or...
{ "repo_id": "huggingface/peft", "file_path": "tests/test_lora_variants.py", "license": "Apache License 2.0", "lines": 257, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/peft:examples/randlora_finetuning/randlora_finetuning.py
# This script is based on examples/dora_finetuning/dora_finetuning.py import os import torch from datasets import load_dataset from transformers import ( AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, DataCollatorForLanguageModeling, Trainer, TrainingArguments, ) from peft import Lor...
{ "repo_id": "huggingface/peft", "file_path": "examples/randlora_finetuning/randlora_finetuning.py", "license": "Apache License 2.0", "lines": 204, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:timm/task/token_distillation.py
"""Token-based distillation training task for models with distillation heads.""" import logging from typing import Dict, Optional, Union import torch import torch.nn as nn import torch.nn.functional as F from timm.models import create_model from timm.utils import unwrap_model from .task import TrainingTask _logger ...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/task/token_distillation.py", "license": "Apache License 2.0", "lines": 293, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:tests/test_scheduler.py
""" Scheduler Tests Tests for learning rate schedulers in timm.scheduler. """ import math import pytest import torch from torch.nn import Parameter from timm.scheduler import ( CosineLRScheduler, StepLRScheduler, MultiStepLRScheduler, PlateauLRScheduler, PolyLRScheduler, TanhLRScheduler, ) fro...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "tests/test_scheduler.py", "license": "Apache License 2.0", "lines": 428, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/pytorch-image-models:timm/models/csatv2.py
"""CSATv2 A frequency-domain vision model using DCT transforms with spatial attention. Paper: TBD This model created by members of MLPA Lab. Welcome feedback and suggestion, questions. gusdlf93@naver.com juno.demie.oh@gmail.com Refined for timm by Ross Wightman """ import math import warnings from functools import ...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/models/csatv2.py", "license": "Apache License 2.0", "lines": 732, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:timm/layers/diff_attention.py
"""Differential Attention Paper: 'Differential Transformer' - https://arxiv.org/abs/2410.05258 Reference impl: https://github.com/microsoft/unilm/tree/master/Diff-Transformer Hacked together by / Copyright 2024, Ross Wightman """ import math from typing import Optional, Type import torch import torch.nn as nn impor...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/layers/diff_attention.py", "license": "Apache License 2.0", "lines": 145, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
huggingface/pytorch-image-models:tests/test_layers_pool.py
"""Tests for timm pooling layers.""" import pytest import torch import torch.nn as nn import importlib import os torch_backend = os.environ.get('TORCH_BACKEND') if torch_backend is not None: importlib.import_module(torch_backend) torch_device = os.environ.get('TORCH_DEVICE', 'cpu') # Adaptive Avg/Max Pooling Te...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "tests/test_layers_pool.py", "license": "Apache License 2.0", "lines": 297, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/pytorch-image-models:timm/layers/other_pool.py
""" Non-Local Attention Pooling Layers A collection of global pooling layers that go beyond simple avg/max pooling. LSEPool - LogSumExp pooling, a smooth approximation between avg and max pooling SimPool - Attention-based pooling from 'Keep It SimPool' (ICCV 2023) Based on implementations from: * LSE Pooling: custom...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/layers/other_pool.py", "license": "Apache License 2.0", "lines": 241, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:tests/test_layers_drop.py
"""Tests for timm.layers.drop module (DropBlock, DropPath).""" import torch import pytest from timm.layers.drop import drop_block_2d, DropBlock2d, drop_path, DropPath class TestDropBlock2d: """Test drop_block_2d function and DropBlock2d module.""" def test_drop_block_2d_output_shape(self): """Test t...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "tests/test_layers_drop.py", "license": "Apache License 2.0", "lines": 203, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/pytorch-image-models:timm/task/classification.py
"""Classification training task.""" import logging from typing import Callable, Dict, Optional, Union import torch import torch.nn as nn from .task import TrainingTask _logger = logging.getLogger(__name__) class ClassificationTask(TrainingTask): """Standard supervised classification task. Simple task that...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/task/classification.py", "license": "Apache License 2.0", "lines": 72, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
huggingface/pytorch-image-models:timm/task/distillation.py
"""Knowledge distillation training tasks and components.""" import logging from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn import torch.nn.functional as F from timm.models import create_model from timm.utils import unwrap_model from .task import TrainingTask _logger = logging.get...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/task/distillation.py", "license": "Apache License 2.0", "lines": 518, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:timm/task/task.py
"""Base training task abstraction. This module provides the base TrainingTask class that encapsulates a complete forward pass including loss computation. Tasks return a dictionary with loss components and outputs for logging. """ from typing import Dict, Optional import torch import torch.nn as nn class TrainingTas...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/task/task.py", "license": "Apache License 2.0", "lines": 81, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
huggingface/pytorch-image-models:timm/layers/coord_attn.py
""" Coordinate Attention and Variants Coordinate Attention decomposes channel attention into two 1D feature encoding processes to capture long-range dependencies with precise positional information. This module includes the original implementation along with simplified and other variants. Papers / References: - Coord...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/layers/coord_attn.py", "license": "Apache License 2.0", "lines": 284, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:timm/optim/muon.py
""" Muon Optimizer Improved Muon optimizer implementation with flexible handling of high-dimensional tensors. Combines PyTorch-style structure with options for: - Batched spatial processing for convolutions in addition to flatten - Optional spatial normalization - Selectable coefficient presets - Automatic fallback t...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/optim/muon.py", "license": "Apache License 2.0", "lines": 876, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:timm/layers/_fx.py
from typing import Callable, Dict, List, Optional, Union, Tuple, Type import torch from torch import nn try: # NOTE we wrap torchvision fns to use timm leaf / no trace definitions from torchvision.models.feature_extraction import create_feature_extractor as _create_feature_extractor from torchvision.model...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/layers/_fx.py", "license": "Apache License 2.0", "lines": 58, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
huggingface/pytorch-image-models:timm/models/mobilenetv5.py
from functools import partial from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import torch import torch.nn as nn import torch.nn.functional as F from timm.data import IMAGENET_INCEPTION_MEAN, IMAGENET_INCEPTION_STD from timm.layers import ( SelectAdaptivePool2d, Linear, LayerType...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/models/mobilenetv5.py", "license": "Apache License 2.0", "lines": 792, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:timm/data/naflex_mixup.py
"""Variable‑size Mixup / CutMix utilities for NaFlex data loaders. This module provides: * `mix_batch_variable_size` – pixel‑level Mixup/CutMix that operates on a list of images whose spatial sizes differ, mixing only their central overlap so no resizing is required. * `pairwise_mixup_target` – builds soft‑label ...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/data/naflex_mixup.py", "license": "Apache License 2.0", "lines": 208, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:timm/data/naflex_random_erasing.py
"""Patch-level random erasing augmentation for NaFlex Vision Transformers. This module implements random erasing specifically designed for patchified images, operating at the patch granularity rather than pixel level. It supports two modes: - 'patch': Randomly erases individual patches (speckle-like noise) - 'region':...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/data/naflex_random_erasing.py", "license": "Apache License 2.0", "lines": 301, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:timm/models/naflexvit.py
""" NaFlex Vision Transformer An improved version of the Vision Transformer with: 1. Encapsulated embedding and position encoding in a single module 2. Support for linear patch embedding on pre-patchified inputs 3. Support for NaFlex variable aspect, variable resolution 4. Support for FlexiViT variable patch size 5. S...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/models/naflexvit.py", "license": "Apache License 2.0", "lines": 1964, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:timm/models/fasternet.py
"""FasterNet Run, Don't Walk: Chasing Higher FLOPS for Faster Neural Networks - paper: https://arxiv.org/abs/2303.03667 - code: https://github.com/JierunChen/FasterNet @article{chen2023run, title={Run, Don't Walk: Chasing Higher FLOPS for Faster Neural Networks}, author={Chen, Jierun and Kao, Shiu-hong and He, Hao...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/models/fasternet.py", "license": "Apache License 2.0", "lines": 437, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/pytorch-image-models:timm/layers/pool1d.py
import torch def global_pool_nlc( x: torch.Tensor, pool_type: str = 'token', num_prefix_tokens: int = 1, reduce_include_prefix: bool = False, ): """Apply global pooling to tensor in NLC format. Args: x: Input tensor in (batch, length, channels) format. pool_typ...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/layers/pool1d.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
huggingface/pytorch-image-models:timm/layers/attention.py
from typing import Final, Optional, Type import torch from torch import nn as nn from torch.nn import functional as F from ._fx import register_notrace_function from .config import use_fused_attn from .pos_embed_sincos import apply_rot_embed_cat @torch.fx.wrap @register_notrace_function def maybe_add_mask(scores: t...
{ "repo_id": "huggingface/pytorch-image-models", "file_path": "timm/layers/attention.py", "license": "Apache License 2.0", "lines": 219, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/smolagents:src/smolagents/serialization.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 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/L...
{ "repo_id": "huggingface/smolagents", "file_path": "src/smolagents/serialization.py", "license": "Apache License 2.0", "lines": 435, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
huggingface/smolagents:tests/test_serialization.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 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/L...
{ "repo_id": "huggingface/smolagents", "file_path": "tests/test_serialization.py", "license": "Apache License 2.0", "lines": 727, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/smolagents:docs/source/es/_config.py
# docstyle-ignore INSTALL_CONTENT = """ # Installation ! pip install smolagents # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/smolagents.git """ notebook_first_cells = [{"type": "code", "content": INST...
{ "repo_id": "huggingface/smolagents", "file_path": "docs/source/es/_config.py", "license": "Apache License 2.0", "lines": 13, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
huggingface/smolagents:tests/test_vision_web_browser.py
"""Test XPath injection vulnerability fix in vision_web_browser.py""" from unittest.mock import Mock, patch import pytest from smolagents.vision_web_browser import _escape_xpath_string, search_item_ctrl_f @pytest.fixture def mock_driver(): """Mock Selenium WebDriver""" driver = Mock() driver.find_eleme...
{ "repo_id": "huggingface/smolagents", "file_path": "tests/test_vision_web_browser.py", "license": "Apache License 2.0", "lines": 110, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/smolagents:examples/structured_output_tool.py
# How to run with uv: # uv run structured_output_tool.py # # Modify the smolagents dependency to point to the local smolagents repo or # remove `@ file:///<path-to-smolagents>` # # /// script # requires-python = ">=3.10" # dependencies = [ # "smolagents[mcp,litellm] @ file:///<path-to-smolagents>", # "pydantic", ...
{ "repo_id": "huggingface/smolagents", "file_path": "examples/structured_output_tool.py", "license": "Apache License 2.0", "lines": 62, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
huggingface/smolagents:tests/test_telemetry.py
# coding=utf-8 # Copyright 2025 HuggingFace Inc. # # 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 law or ag...
{ "repo_id": "huggingface/smolagents", "file_path": "tests/test_telemetry.py", "license": "Apache License 2.0", "lines": 72, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/smolagents:examples/async_agent/main.py
""" Async CodeAgent Example with Starlette This example demonstrates how to use a CodeAgent in an async Starlette app, running the agent in a background thread using anyio.to_thread.run_sync. """ import anyio.to_thread from starlette.applications import Starlette from starlette.requests import Request from starlette....
{ "repo_id": "huggingface/smolagents", "file_path": "examples/async_agent/main.py", "license": "Apache License 2.0", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
huggingface/smolagents:examples/plan_customization/plan_customization.py
""" Plan Customization Example This example demonstrates how to use step callbacks to interrupt the agent after plan creation, allow user interaction to approve or modify the plan, and then resume execution while preserving agent memory. Key concepts demonstrated: 1. Step callbacks to interrupt after PlanningStep 2. ...
{ "repo_id": "huggingface/smolagents", "file_path": "examples/plan_customization/plan_customization.py", "license": "Apache License 2.0", "lines": 133, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
huggingface/smolagents:examples/server/main.py
from anyio import to_thread from starlette.applications import Starlette from starlette.responses import HTMLResponse, JSONResponse from starlette.routing import Route from smolagents import CodeAgent, InferenceClientModel, MCPClient # Create an MCP client to connect to the MCP server mcp_server_parameters = { "...
{ "repo_id": "huggingface/smolagents", "file_path": "examples/server/main.py", "license": "Apache License 2.0", "lines": 192, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
huggingface/transformers:tests/trainer/test_trainer_accelerator.py
# Copyright 2018 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 law or agreed ...
{ "repo_id": "huggingface/transformers", "file_path": "tests/trainer/test_trainer_accelerator.py", "license": "Apache License 2.0", "lines": 223, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/transformers:tests/trainer/test_trainer_checkpointing.py
# Copyright 2018 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 law or agreed ...
{ "repo_id": "huggingface/transformers", "file_path": "tests/trainer/test_trainer_checkpointing.py", "license": "Apache License 2.0", "lines": 1843, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/transformers:tests/trainer/test_trainer_evaluation.py
# Copyright 2018 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 law or agreed ...
{ "repo_id": "huggingface/transformers", "file_path": "tests/trainer/test_trainer_evaluation.py", "license": "Apache License 2.0", "lines": 445, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/transformers:tests/trainer/test_trainer_hyperparameter.py
# Copyright 2018 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 law or agreed ...
{ "repo_id": "huggingface/transformers", "file_path": "tests/trainer/test_trainer_hyperparameter.py", "license": "Apache License 2.0", "lines": 258, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
huggingface/transformers:tests/trainer/trainer_test_utils.py
# Copyright 2018 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 law or agreed ...
{ "repo_id": "huggingface/transformers", "file_path": "tests/trainer/trainer_test_utils.py", "license": "Apache License 2.0", "lines": 499, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test