text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
import inspect
import warnings
from typing import Callable, List, Optional, Union
import numpy as np
import torch
from packaging import version
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, CLIPVisionModelWithProjection
from ...configuration_utils import FrozenDict
from ...image_processor... | diffusers/src/diffusers/pipelines/stable_diffusion_safe/pipeline_stable_diffusion_safe.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/stable_diffusion_safe/pipeline_stable_diffusion_safe.py",
"repo_id": "diffusers",
"token_count": 17680
} | 173 |
import torch.nn as nn
from ...utils import is_accelerate_available, logging
logger = logging.get_logger(__name__)
if is_accelerate_available():
from accelerate import init_empty_weights
def _replace_with_quanto_layers(model, quantization_config, modules_to_not_convert: list, pre_quantized=False):
# Quanto... | diffusers/src/diffusers/quantizers/quanto/utils.py/0 | {
"file_path": "diffusers/src/diffusers/quantizers/quanto/utils.py",
"repo_id": "diffusers",
"token_count": 1048
} | 174 |
# Copyright 2025 Katherine Crowson and 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... | diffusers/src/diffusers/schedulers/scheduling_euler_discrete_flax.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_euler_discrete_flax.py",
"repo_id": "diffusers",
"token_count": 4574
} | 175 |
# # Copyright 2025 Sana-Sprint Authors and 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
#
# Un... | diffusers/src/diffusers/schedulers/scheduling_scm.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_scm.py",
"repo_id": "diffusers",
"token_count": 4597
} | 176 |
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class FlaxStableDiffusionControlNetPipeline(metaclass=DummyObject):
_backends = ["flax", "transformers"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["flax",... | diffusers/src/diffusers/utils/dummy_flax_and_transformers_objects.py/0 | {
"file_path": "diffusers/src/diffusers/utils/dummy_flax_and_transformers_objects.py",
"repo_id": "diffusers",
"token_count": 957
} | 177 |
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class SpectrogramDiffusionPipeline(metaclass=DummyObject):
_backends = ["transformers", "torch", "note_seq"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["tr... | diffusers/src/diffusers/utils/dummy_transformers_and_torch_and_note_seq_objects.py/0 | {
"file_path": "diffusers/src/diffusers/utils/dummy_transformers_and_torch_and_note_seq_objects.py",
"repo_id": "diffusers",
"token_count": 236
} | 178 |
# Copyright 2025 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... | diffusers/src/diffusers/utils/typing_utils.py/0 | {
"file_path": "diffusers/src/diffusers/utils/typing_utils.py",
"repo_id": "diffusers",
"token_count": 1404
} | 179 |
# 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 agreed to in writ... | diffusers/tests/lora/test_lora_layers_lumina2.py/0 | {
"file_path": "diffusers/tests/lora/test_lora_layers_lumina2.py",
"repo_id": "diffusers",
"token_count": 2733
} | 180 |
# 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... | diffusers/tests/models/autoencoders/test_models_autoencoder_kl.py/0 | {
"file_path": "diffusers/tests/models/autoencoders/test_models_autoencoder_kl.py",
"repo_id": "diffusers",
"token_count": 8228
} | 181 |
# 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... | diffusers/tests/models/test_modeling_common.py/0 | {
"file_path": "diffusers/tests/models/test_modeling_common.py",
"repo_id": "diffusers",
"token_count": 48754
} | 182 |
# 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... | diffusers/tests/models/transformers/test_models_transformer_easyanimate.py/0 | {
"file_path": "diffusers/tests/models/transformers/test_models_transformer_easyanimate.py",
"repo_id": "diffusers",
"token_count": 1196
} | 183 |
# 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... | diffusers/tests/models/transformers/test_models_transformer_temporal.py/0 | {
"file_path": "diffusers/tests/models/transformers/test_models_transformer_temporal.py",
"repo_id": "diffusers",
"token_count": 734
} | 184 |
import gc
import tempfile
import unittest
from typing import Callable, Union
import numpy as np
import torch
import diffusers
from diffusers import ComponentsManager, ModularPipeline, ModularPipelineBlocks
from diffusers.utils import logging
from diffusers.utils.testing_utils import (
backend_empty_cache,
num... | diffusers/tests/modular_pipelines/test_modular_pipelines_common.py/0 | {
"file_path": "diffusers/tests/modular_pipelines/test_modular_pipelines_common.py",
"repo_id": "diffusers",
"token_count": 5871
} | 185 |
# 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... | diffusers/tests/pipelines/controlnet/test_controlnet_inpaint.py/0 | {
"file_path": "diffusers/tests/pipelines/controlnet/test_controlnet_inpaint.py",
"repo_id": "diffusers",
"token_count": 10114
} | 186 |
# Copyright 2025 The HuggingFace 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 to in... | diffusers/tests/pipelines/cosmos/test_cosmos.py/0 | {
"file_path": "diffusers/tests/pipelines/cosmos/test_cosmos.py",
"repo_id": "diffusers",
"token_count": 6304
} | 187 |
# 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... | diffusers/tests/pipelines/dit/test_dit.py/0 | {
"file_path": "diffusers/tests/pipelines/dit/test_dit.py",
"repo_id": "diffusers",
"token_count": 2488
} | 188 |
# 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... | diffusers/tests/pipelines/kandinsky2_2/test_kandinsky_combined.py/0 | {
"file_path": "diffusers/tests/pipelines/kandinsky2_2/test_kandinsky_combined.py",
"repo_id": "diffusers",
"token_count": 6197
} | 189 |
import unittest
import torch
from transformers import AutoTokenizer, Gemma2Config, Gemma2Model
from diffusers import (
AutoencoderKL,
FlowMatchEulerDiscreteScheduler,
Lumina2Pipeline,
Lumina2Transformer2DModel,
)
from ..test_pipelines_common import PipelineTesterMixin
class Lumina2PipelineFastTests... | diffusers/tests/pipelines/lumina2/test_pipeline_lumina2.py/0 | {
"file_path": "diffusers/tests/pipelines/lumina2/test_pipeline_lumina2.py",
"repo_id": "diffusers",
"token_count": 1756
} | 190 |
# Copyright 2024 The HuggingFace 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 to in... | diffusers/tests/pipelines/skyreels_v2/test_skyreels_v2.py/0 | {
"file_path": "diffusers/tests/pipelines/skyreels_v2/test_skyreels_v2.py",
"repo_id": "diffusers",
"token_count": 2017
} | 191 |
# 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... | diffusers/tests/pipelines/stable_diffusion/test_stable_diffusion.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion/test_stable_diffusion.py",
"repo_id": "diffusers",
"token_count": 27034
} | 192 |
import random
import unittest
import numpy as np
import torch
from transformers import AutoTokenizer, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, T5EncoderModel
from diffusers import (
AutoencoderKL,
FlowMatchEulerDiscreteScheduler,
SD3Transformer2DModel,
StableDiffusion3InpaintPipelin... | diffusers/tests/pipelines/stable_diffusion_3/test_pipeline_stable_diffusion_3_inpaint.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion_3/test_pipeline_stable_diffusion_3_inpaint.py",
"repo_id": "diffusers",
"token_count": 2565
} | 193 |
import contextlib
import io
import re
import unittest
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AnimateDiffPipeline,
AnimateDiffVideoToVideoPipeline,
AutoencoderKL,
DDIMScheduler,
MotionAdapter,
StableDiffus... | diffusers/tests/pipelines/test_pipeline_utils.py/0 | {
"file_path": "diffusers/tests/pipelines/test_pipeline_utils.py",
"repo_id": "diffusers",
"token_count": 20188
} | 194 |
# Copyright 2025 The HuggingFace 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 to in... | diffusers/tests/pipelines/wan/test_wan_video_to_video.py/0 | {
"file_path": "diffusers/tests/pipelines/wan/test_wan_video_to_video.py",
"repo_id": "diffusers",
"token_count": 2254
} | 195 |
import inspect
import tempfile
import unittest
from typing import Dict, List, Tuple
import torch
from diffusers import EDMEulerScheduler
from .test_schedulers import SchedulerCommonTest
class EDMEulerSchedulerTest(SchedulerCommonTest):
scheduler_classes = (EDMEulerScheduler,)
forward_default_kwargs = (("nu... | diffusers/tests/schedulers/test_scheduler_edm_euler.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_edm_euler.py",
"repo_id": "diffusers",
"token_count": 3799
} | 196 |
import unittest
import torch
import torch.nn.functional as F
from diffusers import VQDiffusionScheduler
from .test_schedulers import SchedulerCommonTest
class VQDiffusionSchedulerTest(SchedulerCommonTest):
scheduler_classes = (VQDiffusionScheduler,)
def get_scheduler_config(self, **kwargs):
config... | diffusers/tests/schedulers/test_scheduler_vq_diffusion.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_vq_diffusion.py",
"repo_id": "diffusers",
"token_count": 715
} | 197 |
# coding=utf-8
# Copyright 2025 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
#
"""
Utility that checks that mo... | diffusers/utils/check_support_list.py/0 | {
"file_path": "diffusers/utils/check_support_list.py",
"repo_id": "diffusers",
"token_count": 2093
} | 198 |
# coding=utf-8
# Copyright 2021 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... | diffusers/utils/tests_fetcher.py/0 | {
"file_path": "diffusers/utils/tests_fetcher.py",
"repo_id": "diffusers",
"token_count": 19563
} | 199 |
# Video benchmark
## Questions
What is the optimal trade-off between:
- maximizing loading time with random access,
- minimizing memory space on disk,
- maximizing success rate of policies,
- compatibility across devices/platforms for decoding videos (e.g. video players, web browsers).
How to encode videos?
- Whic... | lerobot/benchmarks/video/README.md/0 | {
"file_path": "lerobot/benchmarks/video/README.md",
"repo_id": "lerobot",
"token_count": 6190
} | 200 |
# Imitation Learning in Sim
This tutorial will explain how to train a neural network to control a robot in simulation with imitation learning.
**You'll learn:**
1. How to record a dataset in simulation with [gym-hil](https://github.com/huggingface/gym-hil) and visualize the dataset.
2. How to train a policy using yo... | lerobot/docs/source/il_sim.mdx/0 | {
"file_path": "lerobot/docs/source/il_sim.mdx",
"repo_id": "lerobot",
"token_count": 2338
} | 201 |
# 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/LICENSE-2.0
#
# Unless required by appl... | lerobot/examples/2_evaluate_pretrained_policy.py/0 | {
"file_path": "lerobot/examples/2_evaluate_pretrained_policy.py",
"repo_id": "lerobot",
"token_count": 1462
} | 202 |
#!/usr/bin/env python
# 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/LICENSE-2.0
#
# ... | lerobot/src/lerobot/datasets/lerobot_dataset.py/0 | {
"file_path": "lerobot/src/lerobot/datasets/lerobot_dataset.py",
"repo_id": "lerobot",
"token_count": 22296
} | 203 |
#!/usr/bin/env python
# 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/LICENSE-2.0
#
# ... | lerobot/src/lerobot/envs/utils.py/0 | {
"file_path": "lerobot/src/lerobot/envs/utils.py",
"repo_id": "lerobot",
"token_count": 2199
} | 204 |
#!/usr/bin/env python
# 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/LICENSE-2.0
#
# ... | lerobot/src/lerobot/optim/optimizers.py/0 | {
"file_path": "lerobot/src/lerobot/optim/optimizers.py",
"repo_id": "lerobot",
"token_count": 3104
} | 205 |
# 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/LICENSE-2.0
#
# Unless required by appl... | lerobot/src/lerobot/policies/pi0/flex_attention.py/0 | {
"file_path": "lerobot/src/lerobot/policies/pi0/flex_attention.py",
"repo_id": "lerobot",
"token_count": 2050
} | 206 |
#!/usr/bin/env python
# Copyright 2024 Nicklas Hansen, Xiaolong Wang, Hao Su,
# and 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
#
# ht... | lerobot/src/lerobot/policies/tdmpc/modeling_tdmpc.py/0 | {
"file_path": "lerobot/src/lerobot/policies/tdmpc/modeling_tdmpc.py",
"repo_id": "lerobot",
"token_count": 17313
} | 207 |
#!/usr/bin/env python
# Copyright 2025 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
#
# ... | lerobot/src/lerobot/robots/bi_so100_follower/bi_so100_follower.py/0 | {
"file_path": "lerobot/src/lerobot/robots/bi_so100_follower/bi_so100_follower.py",
"repo_id": "lerobot",
"token_count": 2489
} | 208 |
# 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/LICENSE-2.0
#
# Unless required by appl... | lerobot/src/lerobot/robots/lekiwi/lekiwi_client.py/0 | {
"file_path": "lerobot/src/lerobot/robots/lekiwi/lekiwi_client.py",
"repo_id": "lerobot",
"token_count": 5528
} | 209 |
# 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/LICENSE-2.0
#
# Unless required by appl... | lerobot/src/lerobot/robots/utils.py/0 | {
"file_path": "lerobot/src/lerobot/robots/utils.py",
"repo_id": "lerobot",
"token_count": 1426
} | 210 |
# Copyright 2025 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... | lerobot/src/lerobot/scripts/server/helpers.py/0 | {
"file_path": "lerobot/src/lerobot/scripts/server/helpers.py",
"repo_id": "lerobot",
"token_count": 3749
} | 211 |
#!/usr/bin/env python
# Copyright 2025 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
#
# ... | lerobot/src/lerobot/teleoperators/gamepad/gamepad_utils.py/0 | {
"file_path": "lerobot/src/lerobot/teleoperators/gamepad/gamepad_utils.py",
"repo_id": "lerobot",
"token_count": 8218
} | 212 |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings
from lerobot.transport import services_pb2 as lerobot_dot_transport_dot_services__pb2
GRPC_GENERATED_VERSION = '1.73.1'
GRPC_VERSION = grpc.__ve... | lerobot/src/lerobot/transport/services_pb2_grpc.py/0 | {
"file_path": "lerobot/src/lerobot/transport/services_pb2_grpc.py",
"repo_id": "lerobot",
"token_count": 8161
} | 213 |
#!/usr/bin/env python
# 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/LICENSE-2.0
#
# ... | lerobot/src/lerobot/utils/utils.py/0 | {
"file_path": "lerobot/src/lerobot/utils/utils.py",
"repo_id": "lerobot",
"token_count": 4718
} | 214 |
# 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/LICENSE-2.0
#
# Unless required by appl... | lerobot/tests/datasets/test_image_writer.py/0 | {
"file_path": "lerobot/tests/datasets/test_image_writer.py",
"repo_id": "lerobot",
"token_count": 5558
} | 215 |
#!/usr/bin/env python
# Copyright 2025 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
#
# ... | lerobot/tests/mocks/mock_serial_patch.py/0 | {
"file_path": "lerobot/tests/mocks/mock_serial_patch.py",
"repo_id": "lerobot",
"token_count": 609
} | 216 |
#!/usr/bin/env python
# Copyright 2025 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
#
# ... | lerobot/tests/rl/test_actor.py/0 | {
"file_path": "lerobot/tests/rl/test_actor.py",
"repo_id": "lerobot",
"token_count": 2616
} | 217 |
.PHONY: style quality
# make sure to test the local checkout in scripts and not the pre-installed one (don't use quotes!)
export PYTHONPATH = src
check_dirs := src tests
# dev dependencies
install:
uv venv openr1 --python 3.11
. openr1/bin/activate && uv pip install --upgrade pip && \
uv pip install vllm==0.8.5.... | open-r1/Makefile/0 | {
"file_path": "open-r1/Makefile",
"repo_id": "open-r1",
"token_count": 696
} | 218 |
# Copyright 2025 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... | open-r1/setup.py/0 | {
"file_path": "open-r1/setup.py",
"repo_id": "open-r1",
"token_count": 2235
} | 219 |
# Copyright 2025 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... | open-r1/src/open_r1/generate.py/0 | {
"file_path": "open-r1/src/open_r1/generate.py",
"repo_id": "open-r1",
"token_count": 2696
} | 220 |
import subprocess
from typing import TYPE_CHECKING, Dict, Union
from .hub import get_gpu_count_for_vllm, get_param_count_from_repo_id
if TYPE_CHECKING:
from trl import GRPOConfig, SFTConfig, ModelConfig
import base64
import os
# We need a special environment setup to launch vLLM from within Slurm training job... | open-r1/src/open_r1/utils/evaluation.py/0 | {
"file_path": "open-r1/src/open_r1/utils/evaluation.py",
"repo_id": "open-r1",
"token_count": 1879
} | 221 |
# Builds GPU docker image of PyTorch
# Uses multi-staged approach to reduce size
# Stage 1
# Use base conda image to reduce time
FROM continuumio/miniconda3:latest AS compile-image
# Specify py version
ENV PYTHON_VERSION=3.11
# Install apt libs - copied from https://github.com/huggingface/accelerate/blob/main/docker/ac... | peft/docker/peft-gpu-bnb-latest/Dockerfile/0 | {
"file_path": "peft/docker/peft-gpu-bnb-latest/Dockerfile",
"repo_id": "peft",
"token_count": 817
} | 222 |
<!--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 applicable law or agreed... | peft/docs/source/developer_guides/lora.md/0 | {
"file_path": "peft/docs/source/developer_guides/lora.md",
"repo_id": "peft",
"token_count": 9665
} | 223 |
<!--⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.
-->
# Models
[`PeftModel`] is the base model class for specifying the base Transformer model and configuration to apply a PEFT method to. The base `Peft... | peft/docs/source/package_reference/peft_model.md/0 | {
"file_path": "peft/docs/source/package_reference/peft_model.md",
"repo_id": "peft",
"token_count": 564
} | 224 |
<!--Copyright 2024 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 applicable law or agreed... | peft/docs/source/task_guides/prompt_based_methods.md/0 | {
"file_path": "peft/docs/source/task_guides/prompt_based_methods.md",
"repo_id": "peft",
"token_count": 4708
} | 225 |
# 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... | peft/examples/boft_controlnet/utils/pipeline_controlnet.py/0 | {
"file_path": "peft/examples/boft_controlnet/utils/pipeline_controlnet.py",
"repo_id": "peft",
"token_count": 10001
} | 226 |
compute_environment: LOCAL_MACHINE
deepspeed_config:
gradient_accumulation_steps: 1
gradient_clipping: 1.0
offload_optimizer_device: none
offload_param_device: none
zero3_init_flag: true
zero3_save_16bit_model: true
zero_stage: 3
distributed_type: DEEPSPEED
downcast_bf16: 'no'
dynamo_backend: 'NO'
fsdp_co... | peft/examples/causal_language_modeling/accelerate_ds_zero3_cpu_offload_config.yaml/0 | {
"file_path": "peft/examples/causal_language_modeling/accelerate_ds_zero3_cpu_offload_config.yaml",
"repo_id": "peft",
"token_count": 198
} | 227 |
# 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... | peft/examples/eva_finetuning/utils.py/0 | {
"file_path": "peft/examples/eva_finetuning/utils.py",
"repo_id": "peft",
"token_count": 1382
} | 228 |
# Fine-tuning for image classification using LoRA and 🤗 PEFT
## Vision Transformer model from transformers
[](https://colab.research.google.com/github/huggingface/peft/blob/main/examples/image_classification/image_classification_peft_lora.ipyn... | peft/examples/image_classification/README.md/0 | {
"file_path": "peft/examples/image_classification/README.md",
"repo_id": "peft",
"token_count": 459
} | 229 |
import argparse
import os
from collections import Counter
from dataclasses import dataclass
from typing import Optional
import safetensors
import torch
from diffusers import UNet2DConditionModel
from transformers import CLIPTextModel
from peft import LoraConfig, get_peft_model, get_peft_model_state_dict, set_peft_mod... | peft/examples/lora_dreambooth/convert_kohya_ss_sd_lora_to_peft.py/0 | {
"file_path": "peft/examples/lora_dreambooth/convert_kohya_ss_sd_lora_to_peft.py",
"repo_id": "peft",
"token_count": 2938
} | 230 |
# OLoRA: Orthonormal Low Rank Adaptation of Large Language Models
## Introduction
[OLoRA](https://huggingface.co/papers/2406.01775) is a novel approach that leverages orthonormal low rank adaptation through QR decomposition. Unlike the default LoRA implementation, OLoRA decomposes original weights into their $\mathbf{... | peft/examples/olora_finetuning/README.md/0 | {
"file_path": "peft/examples/olora_finetuning/README.md",
"repo_id": "peft",
"token_count": 1445
} | 231 |
import argparse
import json
import logging
import os
from collections import Counter
from dataclasses import dataclass
from operator import attrgetter
from typing import Optional, Union
import safetensors
import torch
import torch.nn as nn
from diffusers import UNet2DConditionModel
from transformers import CLIPTextMod... | peft/examples/stable_diffusion/convert_sd_adapter_to_peft.py/0 | {
"file_path": "peft/examples/stable_diffusion/convert_sd_adapter_to_peft.py",
"repo_id": "peft",
"token_count": 10375
} | 232 |
{
"auto_mapping": null,
"base_model_name_or_path": null,
"bias": "none",
"boft_block_num": 0,
"boft_block_size": 4,
"boft_dropout": 0.0,
"boft_n_butterfly_factor": 1,
"exclude_modules": null,
"fan_in_fan_out": false,
"inference_mode": false,
"init_weights": true,
"layers_pattern": null,
"layer... | peft/method_comparison/MetaMathQA/experiments/boft/llama-3.2-3B-default/adapter_config.json/0 | {
"file_path": "peft/method_comparison/MetaMathQA/experiments/boft/llama-3.2-3B-default/adapter_config.json",
"repo_id": "peft",
"token_count": 202
} | 233 |
{
"optimizer_type": "lora-fa",
"optimizer_kwargs": {
"r": 32,
"lora_alpha": 64,
"lr": 1e-4,
"weight_decay": 0.1
}
}
| peft/method_comparison/MetaMathQA/experiments/lora/llama-3.2-3B-rank32-lorafa/training_params.json/0 | {
"file_path": "peft/method_comparison/MetaMathQA/experiments/lora/llama-3.2-3B-rank32-lorafa/training_params.json",
"repo_id": "peft",
"token_count": 77
} | 234 |
{
"auto_mapping": null,
"base_model_name_or_path": null,
"peft_type": "TRAINABLE_TOKENS",
"token_indices": [128000, 128001],
"task_type": "CAUSAL_LM"
}
| peft/method_comparison/MetaMathQA/experiments/trainable_tokens/llama-3.2-3B-sos+eos/adapter_config.json/0 | {
"file_path": "peft/method_comparison/MetaMathQA/experiments/trainable_tokens/llama-3.2-3B-sos+eos/adapter_config.json",
"repo_id": "peft",
"token_count": 77
} | 235 |
{
"short": [
"Explain quantum computing in one paragraph.",
"Write a haiku about machine learning.",
"What's the difference between supervised and unsupervised learning?",
"Define parameter-efficient fine-tuning in one sentence.",
"List three applications of natural language processing."
],
"m... | peft/method_comparison/text_generation_benchmark/configs/prompts.json/0 | {
"file_path": "peft/method_comparison/text_generation_benchmark/configs/prompts.json",
"repo_id": "peft",
"token_count": 459
} | 236 |
# 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... | peft/scripts/train_memory.py/0 | {
"file_path": "peft/scripts/train_memory.py",
"repo_id": "peft",
"token_count": 4392
} | 237 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from https://botorch.org/api/_modules/botorch/utils/torch.html
# TODO: To be removed once (if) https://github.com/pytorch/pytorch... | peft/src/peft/tuners/_buffer_dict.py/0 | {
"file_path": "peft/src/peft/tuners/_buffer_dict.py",
"repo_id": "peft",
"token_count": 2436
} | 238 |
// Author: Yao Feng
// Date: 2023/08
// Description: cuda kernel for fast block diag
#include <ATen/ATen.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <vector>
namespace{
template <typename scalar_t>
__global__ void forward_fast_block_diag_cuda_kernel(
const scalar_t* __restrict__ input, //[z, N, b... | peft/src/peft/tuners/boft/fbd/fbd_cuda_kernel.cu/0 | {
"file_path": "peft/src/peft/tuners/boft/fbd/fbd_cuda_kernel.cu",
"repo_id": "peft",
"token_count": 1511
} | 239 |
# 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... | peft/src/peft/tuners/fourierft/config.py/0 | {
"file_path": "peft/src/peft/tuners/fourierft/config.py",
"repo_id": "peft",
"token_count": 4510
} | 240 |
# 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... | peft/src/peft/tuners/lora/eva.py/0 | {
"file_path": "peft/src/peft/tuners/lora/eva.py",
"repo_id": "peft",
"token_count": 13577
} | 241 |
# 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... | peft/src/peft/tuners/p_tuning/model.py/0 | {
"file_path": "peft/src/peft/tuners/p_tuning/model.py",
"repo_id": "peft",
"token_count": 2476
} | 242 |
# 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... | peft/src/peft/tuners/randlora/model.py/0 | {
"file_path": "peft/src/peft/tuners/randlora/model.py",
"repo_id": "peft",
"token_count": 10778
} | 243 |
# 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... | peft/src/peft/utils/hotswap.py/0 | {
"file_path": "peft/src/peft/utils/hotswap.py",
"repo_id": "peft",
"token_count": 10563
} | 244 |
# 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... | peft/tests/test_boft.py/0 | {
"file_path": "peft/tests/test_boft.py",
"repo_id": "peft",
"token_count": 1325
} | 245 |
#!/usr/bin/env python3
# coding=utf-8
# 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
#... | peft/tests/test_lora_megatron.py/0 | {
"file_path": "peft/tests/test_lora_megatron.py",
"repo_id": "peft",
"token_count": 2989
} | 246 |
# 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... | peft/tests/test_trainable_tokens.py/0 | {
"file_path": "peft/tests/test_trainable_tokens.py",
"repo_id": "peft",
"token_count": 16792
} | 247 |
# Feature Extraction
All of the models in `timm` have consistent mechanisms for obtaining various types of features from the model for tasks besides classification.
## Penultimate Layer Features (Pre-Classifier Features)
The features from the penultimate model layer can be obtained in several ways without requiring ... | pytorch-image-models/hfdocs/source/feature_extraction.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/feature_extraction.mdx",
"repo_id": "pytorch-image-models",
"token_count": 3391
} | 248 |
# EfficientNet
**EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method uniformly scales network wid... | pytorch-image-models/hfdocs/source/models/efficientnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/efficientnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 4915
} | 249 |
# (Legacy) SE-ResNeXt
**SE ResNeXt** is a variant of a [ResNeXt](https://www.paperswithcode.com/method/resnext) that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration.
## How do I use this... | pytorch-image-models/hfdocs/source/models/legacy-se-resnext.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/legacy-se-resnext.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2733
} | 250 |
# ResNeXt
A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transformations) \\( ... | pytorch-image-models/hfdocs/source/models/resnext.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/resnext.mdx",
"repo_id": "pytorch-image-models",
"token_count": 3059
} | 251 |
# (Tensorflow) MobileNet v3
**MobileNetV3** is a convolutional neural network that is designed for mobile phone CPUs. The network design includes the use of a [hard swish activation](https://paperswithcode.com/method/hard-swish) and [squeeze-and-excitation](https://paperswithcode.com/method/squeeze-and-excitation-bloc... | pytorch-image-models/hfdocs/source/models/tf-mobilenet-v3.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/tf-mobilenet-v3.mdx",
"repo_id": "pytorch-image-models",
"token_count": 4784
} | 252 |
from torch.nn.modules.batchnorm import BatchNorm2d
from torchvision.ops.misc import FrozenBatchNorm2d
import timm
import pytest
from timm.utils.model import freeze, unfreeze
from timm.utils.model import ActivationStatsHook
from timm.utils.model import extract_spp_stats
from timm.utils.model import _freeze_unfreeze
fr... | pytorch-image-models/tests/test_utils.py/0 | {
"file_path": "pytorch-image-models/tests/test_utils.py",
"repo_id": "pytorch-image-models",
"token_count": 2521
} | 253 |
""" Loader Factory, Fast Collate, CUDA Prefetcher
Prefetcher and Fast Collate inspired by NVIDIA APEX example at
https://github.com/NVIDIA/apex/commit/d5e2bb4bdeedd27b1dfaf5bb2b24d6c000dee9be#diff-cf86c282ff7fba81fad27a559379d5bf
Hacked together by / Copyright 2019, Ross Wightman
"""
import logging
import random
from... | pytorch-image-models/timm/data/loader.py/0 | {
"file_path": "pytorch-image-models/timm/data/loader.py",
"repo_id": "pytorch-image-models",
"token_count": 7171
} | 254 |
""" A dataset reader that reads tarfile based datasets
This reader can extract image samples from:
* a single tar of image files
* a folder of multiple tarfiles containing imagefiles
* a tar of tars containing image files
Labels are based on the combined folder and/or tar name structure.
Hacked together by / Copyrig... | pytorch-image-models/timm/data/readers/reader_image_in_tar.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/reader_image_in_tar.py",
"repo_id": "pytorch-image-models",
"token_count": 4050
} | 255 |
from typing import Optional, Type
import torch
import torch.nn as nn
import torch.nn.functional as F
from .attention import maybe_add_mask
from .config import use_fused_attn
from .mlp import Mlp
from .weight_init import trunc_normal_tf_
class AttentionPoolLatent(nn.Module):
""" Attention pooling w/ latent query... | pytorch-image-models/timm/layers/attention_pool.py/0 | {
"file_path": "pytorch-image-models/timm/layers/attention_pool.py",
"repo_id": "pytorch-image-models",
"token_count": 1995
} | 256 |
"""
ECA module from ECAnet
paper: ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks
https://arxiv.org/abs/1910.03151
Original ECA model borrowed from https://github.com/BangguWu/ECANet
Modified circular ECA implementation and adaption for use in timm package
by Chris Ha https://github.com/V... | pytorch-image-models/timm/layers/eca.py/0 | {
"file_path": "pytorch-image-models/timm/layers/eca.py",
"repo_id": "pytorch-image-models",
"token_count": 2411
} | 257 |
""" Linear layer (alternate definition)
"""
import torch
import torch.nn.functional as F
from torch import nn as nn
class Linear(nn.Linear):
r"""Applies a linear transformation to the incoming data: :math:`y = xA^T + b`
Wraps torch.nn.Linear to support AMP + torchscript usage by manually casting
weight &... | pytorch-image-models/timm/layers/linear.py/0 | {
"file_path": "pytorch-image-models/timm/layers/linear.py",
"repo_id": "pytorch-image-models",
"token_count": 282
} | 258 |
""" Selective Kernel Convolution/Attention
Paper: Selective Kernel Networks (https://arxiv.org/abs/1903.06586)
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
from torch import nn as nn
from .conv_bn_act import ConvNormAct
from .helpers import make_divisible
from .trace_utils import _assert
def ... | pytorch-image-models/timm/layers/selective_kernel.py/0 | {
"file_path": "pytorch-image-models/timm/layers/selective_kernel.py",
"repo_id": "pytorch-image-models",
"token_count": 2314
} | 259 |
from .beit import *
from .byoanet import *
from .byobnet import *
from .cait import *
from .coat import *
from .convit import *
from .convmixer import *
from .convnext import *
from .crossvit import *
from .cspnet import *
from .davit import *
from .deit import *
from .densenet import *
from .dla import *
from .dpn imp... | pytorch-image-models/timm/models/__init__.py/0 | {
"file_path": "pytorch-image-models/timm/models/__init__.py",
"repo_id": "pytorch-image-models",
"token_count": 1833
} | 260 |
""" PyTorch implementation of DualPathNetworks
Based on original MXNet implementation https://github.com/cypw/DPNs with
many ideas from another PyTorch implementation https://github.com/oyam/pytorch-DPNs.
This implementation is compatible with the pretrained weights from cypw's MXNet implementation.
Hacked together b... | pytorch-image-models/timm/models/dpn.py/0 | {
"file_path": "pytorch-image-models/timm/models/dpn.py",
"repo_id": "pytorch-image-models",
"token_count": 7004
} | 261 |
from functools import partial
import torch.nn as nn
from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
from ._builder import build_model_with_cfg
from ._builder import pretrained_cfg_for_features
from ._efficientnet_blocks import SqueezeExcite
from ._efficientnet_builder import decode_arch_def, resolve... | pytorch-image-models/timm/models/hardcorenas.py/0 | {
"file_path": "pytorch-image-models/timm/models/hardcorenas.py",
"repo_id": "pytorch-image-models",
"token_count": 4629
} | 262 |
""" MLP-Mixer, ResMLP, and gMLP in PyTorch
This impl originally based on MLP-Mixer paper.
Official JAX impl: https://github.com/google-research/vision_transformer/blob/linen/vit_jax/models_mixer.py
Paper: 'MLP-Mixer: An all-MLP Architecture for Vision' - https://arxiv.org/abs/2105.01601
@article{tolstikhin2021,
t... | pytorch-image-models/timm/models/mlp_mixer.py/0 | {
"file_path": "pytorch-image-models/timm/models/mlp_mixer.py",
"repo_id": "pytorch-image-models",
"token_count": 15333
} | 263 |
"""
An implementation of RepGhostNet Model as defined in:
RepGhost: A Hardware-Efficient Ghost Module via Re-parameterization. https://arxiv.org/abs/2211.06088
Original implementation: https://github.com/ChengpengChen/RepGhost
"""
import copy
from functools import partial
from typing import List, Optional, Tuple, Unio... | pytorch-image-models/timm/models/repghost.py/0 | {
"file_path": "pytorch-image-models/timm/models/repghost.py",
"repo_id": "pytorch-image-models",
"token_count": 9456
} | 264 |
""" Swin Transformer V2
A PyTorch impl of : `Swin Transformer V2: Scaling Up Capacity and Resolution`
- https://arxiv.org/pdf/2111.09883
Code adapted from https://github.com/ChristophReich1996/Swin-Transformer-V2, original copyright/license info below
This implementation is experimental and subject to change in ... | pytorch-image-models/timm/models/swin_transformer_v2_cr.py/0 | {
"file_path": "pytorch-image-models/timm/models/swin_transformer_v2_cr.py",
"repo_id": "pytorch-image-models",
"token_count": 21802
} | 265 |
""" Cross-Covariance Image Transformer (XCiT) in PyTorch
Paper:
- https://arxiv.org/abs/2106.09681
Same as the official implementation, with some minor adaptations, original copyright below
- https://github.com/facebookresearch/xcit/blob/master/xcit.py
Modifications and additions for timm hacked together by ... | pytorch-image-models/timm/models/xcit.py/0 | {
"file_path": "pytorch-image-models/timm/models/xcit.py",
"repo_id": "pytorch-image-models",
"token_count": 20592
} | 266 |
""" PyTorch LARS / LARC Optimizer
An implementation of LARS (SGD) + LARC in PyTorch
Based on:
* PyTorch SGD: https://github.com/pytorch/pytorch/blob/1.7/torch/optim/sgd.py#L100
* NVIDIA APEX LARC: https://github.com/NVIDIA/apex/blob/master/apex/parallel/LARC.py
Additional cleanup and modifications to properly su... | pytorch-image-models/timm/optim/lars.py/0 | {
"file_path": "pytorch-image-models/timm/optim/lars.py",
"repo_id": "pytorch-image-models",
"token_count": 2549
} | 267 |
""" MultiStep LR Scheduler
Basic multi step LR schedule with warmup, noise.
"""
import torch
import bisect
from timm.scheduler.scheduler import Scheduler
from typing import List
class MultiStepLRScheduler(Scheduler):
"""
"""
def __init__(
self,
optimizer: torch.optim.Optimizer,
... | pytorch-image-models/timm/scheduler/multistep_lr.py/0 | {
"file_path": "pytorch-image-models/timm/scheduler/multistep_lr.py",
"repo_id": "pytorch-image-models",
"token_count": 1036
} | 268 |
""" Logging helpers
Hacked together by / Copyright 2020 Ross Wightman
"""
import logging
import logging.handlers
class FormatterNoInfo(logging.Formatter):
def __init__(self, fmt='%(levelname)s: %(message)s'):
logging.Formatter.__init__(self, fmt)
def format(self, record):
if record.levelno =... | pytorch-image-models/timm/utils/log.py/0 | {
"file_path": "pytorch-image-models/timm/utils/log.py",
"repo_id": "pytorch-image-models",
"token_count": 383
} | 269 |
# Human-in-the-Loop: Customize Agent Plan Interactively
This page demonstrates advanced usage of the smolagents library, with a special focus on **Human-in-the-Loop (HITL)** approaches for interactive plan creation, user-driven plan modification, and memory preservation in agentic workflows.
The example is based on th... | smolagents/docs/source/en/examples/plan_customization.md/0 | {
"file_path": "smolagents/docs/source/en/examples/plan_customization.md",
"repo_id": "smolagents",
"token_count": 996
} | 270 |
# Tools
[[open-in-colab]]
Here, we're going to see advanced tool usage.
> [!TIP]
> If you're new to building agents, make sure to first read the [intro to agents](../conceptual_guides/intro_agents) and the [guided tour of smolagents](../guided_tour).
### What is a tool, and how to build one?
A tool is mostly a fu... | smolagents/docs/source/en/tutorials/tools.md/0 | {
"file_path": "smolagents/docs/source/en/tutorials/tools.md",
"repo_id": "smolagents",
"token_count": 5412
} | 271 |
# 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... | smolagents/docs/source/ko/_config.py/0 | {
"file_path": "smolagents/docs/source/ko/_config.py",
"repo_id": "smolagents",
"token_count": 155
} | 272 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.