text stringlengths 96 319k | id stringlengths 14 178 | metadata dict |
|---|---|---|
<!--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... | diffusers/docs/source/ko/index.md/0 | {
"file_path": "diffusers/docs/source/ko/index.md",
"repo_id": "diffusers",
"token_count": 2459
} |
<!--Copyright 2024 Custom Diffusion authors 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... | diffusers/docs/source/ko/training/custom_diffusion.md/0 | {
"file_path": "diffusers/docs/source/ko/training/custom_diffusion.md",
"repo_id": "diffusers",
"token_count": 7041
} |
<!--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... | diffusers/docs/source/ko/using-diffusers/img2img.md/0 | {
"file_path": "diffusers/docs/source/ko/using-diffusers/img2img.md",
"repo_id": "diffusers",
"token_count": 2084
} |
#!/usr/bin/env python
# coding=utf-8
# 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/LI... | diffusers/examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py/0 | {
"file_path": "diffusers/examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py",
"repo_id": "diffusers",
"token_count": 47389
} |
import inspect
from typing import Any, Callable, Dict, List, Optional, Union
import numpy as np
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers.image_processor import VaeImageProcessor
from diffusers.loaders import FromSingleFileMixin, StableDiffusionLoraLoaderMix... | diffusers/examples/community/latent_consistency_interpolate.py/0 | {
"file_path": "diffusers/examples/community/latent_consistency_interpolate.py",
"repo_id": "diffusers",
"token_count": 22091
} |
# 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 applicabl... | diffusers/examples/community/pipeline_animatediff_img2video.py/0 | {
"file_path": "diffusers/examples/community/pipeline_animatediff_img2video.py",
"repo_id": "diffusers",
"token_count": 20616
} |
import types
from typing import List, Optional, Tuple, Union
import torch
from transformers import CLIPTextModelWithProjection, CLIPTokenizer
from transformers.models.clip.modeling_clip import CLIPTextModelOutput
from diffusers.models import PriorTransformer
from diffusers.pipelines import DiffusionPipeline, StableDi... | diffusers/examples/community/stable_unclip.py/0 | {
"file_path": "diffusers/examples/community/stable_unclip.py",
"repo_id": "diffusers",
"token_count": 5488
} |
# ControlNet training example
[Adding Conditional Control to Text-to-Image Diffusion Models](https://arxiv.org/abs/2302.05543) by Lvmin Zhang and Maneesh Agrawala.
This example is based on the [training example in the original ControlNet repository](https://github.com/lllyasviel/ControlNet/blob/main/docs/train.md). I... | diffusers/examples/controlnet/README.md/0 | {
"file_path": "diffusers/examples/controlnet/README.md",
"repo_id": "diffusers",
"token_count": 6086
} |
# coding=utf-8
# Copyright 2024 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/examples/dreambooth/test_dreambooth.py/0 | {
"file_path": "diffusers/examples/dreambooth/test_dreambooth.py",
"repo_id": "diffusers",
"token_count": 4466
} |
# InstructPix2Pix text-to-edit-image fine-tuning
This extended LoRA training script was authored by [Aiden-Frost](https://github.com/Aiden-Frost).
This is an experimental LoRA extension of [this example](https://github.com/huggingface/diffusers/blob/main/examples/instruct_pix2pix/train_instruct_pix2pix.py). This script... | diffusers/examples/research_projects/instructpix2pix_lora/README.md/0 | {
"file_path": "diffusers/examples/research_projects/instructpix2pix_lora/README.md",
"repo_id": "diffusers",
"token_count": 1406
} |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | diffusers/examples/research_projects/pixart/train_pixart_controlnet_hf.py/0 | {
"file_path": "diffusers/examples/research_projects/pixart/train_pixart_controlnet_hf.py",
"repo_id": "diffusers",
"token_count": 21169
} |
import argparse
import copy
import itertools
import logging
import math
import os
import random
import shutil
from pathlib import Path
import numpy as np
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
import torchvision.transforms.v2 as transforms_v2
import transformers
from accelerate impo... | diffusers/examples/research_projects/realfill/train_realfill.py/0 | {
"file_path": "diffusers/examples/research_projects/realfill/train_realfill.py",
"repo_id": "diffusers",
"token_count": 16396
} |
# VAE
`vae_roundtrip.py` Demonstrates the use of a VAE by roundtripping an image through the encoder and decoder. Original and reconstructed images are displayed side by side.
```
cd examples/research_projects/vae
python vae_roundtrip.py \
--pretrained_model_name_or_path="stable-diffusion-v1-5/stable-diffusion-v1... | diffusers/examples/research_projects/vae/README.md/0 | {
"file_path": "diffusers/examples/research_projects/vae/README.md",
"repo_id": "diffusers",
"token_count": 140
} |
import argparse
from typing import Any, Dict
import torch
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
from diffusers import AutoencoderDC
def remap_qkv_(key: str, state_dict: Dict[str, Any]):
qkv = state_dict.pop(key)
q, k, v = torch.chunk(qkv, 3, dim=0)
parent_mo... | diffusers/scripts/convert_dcae_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_dcae_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 6118
} |
# 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
#
# Unless required by applicable... | diffusers/scripts/convert_original_t2i_adapter.py/0 | {
"file_path": "diffusers/scripts/convert_original_t2i_adapter.py",
"repo_id": "diffusers",
"token_count": 6734
} |
# Convert the original UniDiffuser checkpoints into diffusers equivalents.
import argparse
from argparse import Namespace
import torch
from transformers import (
CLIPImageProcessor,
CLIPTextConfig,
CLIPTextModel,
CLIPTokenizer,
CLIPVisionConfig,
CLIPVisionModelWithProjection,
GPT2Tokenizer... | diffusers/scripts/convert_unidiffuser_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_unidiffuser_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 13871
} |
# coding=utf-8
# Copyright 2025 The HuggingFace Inc. team.
# Copyright (c) 2022, NVIDIA CORPORATION. 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.a... | diffusers/src/diffusers/configuration_utils.py/0 | {
"file_path": "diffusers/src/diffusers/configuration_utils.py",
"repo_id": "diffusers",
"token_count": 14673
} |
# 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 applicabl... | diffusers/src/diffusers/loaders/lora_pipeline.py/0 | {
"file_path": "diffusers/src/diffusers/loaders/lora_pipeline.py",
"repo_id": "diffusers",
"token_count": 79975
} |
# 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 applicabl... | diffusers/src/diffusers/models/attention_flax.py/0 | {
"file_path": "diffusers/src/diffusers/models/attention_flax.py",
"repo_id": "diffusers",
"token_count": 9064
} |
# 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 applicabl... | diffusers/src/diffusers/models/autoencoders/vq_model.py/0 | {
"file_path": "diffusers/src/diffusers/models/autoencoders/vq_model.py",
"repo_id": "diffusers",
"token_count": 3260
} |
# 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 applicabl... | diffusers/src/diffusers/models/downsampling.py/0 | {
"file_path": "diffusers/src/diffusers/models/downsampling.py",
"repo_id": "diffusers",
"token_count": 7040
} |
# Copyright 2024 ConsisID 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
#
# Unless ... | diffusers/src/diffusers/models/transformers/consisid_transformer_3d.py/0 | {
"file_path": "diffusers/src/diffusers/models/transformers/consisid_transformer_3d.py",
"repo_id": "diffusers",
"token_count": 15854
} |
# Copyright 2024 The Genmo team 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/models/transformers/transformer_ltx.py/0 | {
"file_path": "diffusers/src/diffusers/models/transformers/transformer_ltx.py",
"repo_id": "diffusers",
"token_count": 8198
} |
# 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 applicabl... | diffusers/src/diffusers/models/unets/unet_motion_model.py/0 | {
"file_path": "diffusers/src/diffusers/models/unets/unet_motion_model.py",
"repo_id": "diffusers",
"token_count": 47486
} |
# 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
#
# Unless required by applicable... | diffusers/src/diffusers/pipelines/auto_pipeline.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/auto_pipeline.py",
"repo_id": "diffusers",
"token_count": 24515
} |
import importlib.util
import os
import cv2
import numpy as np
import torch
from PIL import Image, ImageOps
from torchvision.transforms import InterpolationMode
from torchvision.transforms.functional import normalize, resize
from ...utils import load_image
_insightface_available = importlib.util.find_spec("insightfa... | diffusers/src/diffusers/pipelines/consisid/consisid_utils.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/consisid/consisid_utils.py",
"repo_id": "diffusers",
"token_count": 5836
} |
# Copyright 2022 The Music Spectrogram Diffusion Authors.
# 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... | diffusers/src/diffusers/pipelines/deprecated/spectrogram_diffusion/notes_encoder.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/deprecated/spectrogram_diffusion/notes_encoder.py",
"repo_id": "diffusers",
"token_count": 1254
} |
# 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 applicabl... | diffusers/src/diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py",
"repo_id": "diffusers",
"token_count": 9882
} |
# 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 applicabl... | diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py",
"repo_id": "diffusers",
"token_count": 12891
} |
# 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... | diffusers/src/diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion_xl.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion_xl.py",
"repo_id": "diffusers",
"token_count": 42483
} |
# 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 applicabl... | diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py",
"repo_id": "diffusers",
"token_count": 9438
} |
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": 17645
} |
from typing import TYPE_CHECKING
from ...utils import (
DIFFUSERS_SLOW_IMPORT,
OptionalDependencyNotAvailable,
_LazyModule,
get_objects_from_module,
is_torch_available,
is_transformers_available,
)
_dummy_objects = {}
_import_structure = {}
try:
if not (is_transformers_available() and is... | diffusers/src/diffusers/pipelines/wuerstchen/__init__.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/wuerstchen/__init__.py",
"repo_id": "diffusers",
"token_count": 849
} |
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
from ..base import DiffusersQuantizer
if TYPE_CHECKING:
from ...models.modeling_utils import ModelMixin
from ...utils import (
get_module_from_name,
is_accelerate_available,
is_accelerate_version,
is_gguf_available,
is_gguf_... | diffusers/src/diffusers/quantizers/gguf/gguf_quantizer.py/0 | {
"file_path": "diffusers/src/diffusers/quantizers/gguf/gguf_quantizer.py",
"repo_id": "diffusers",
"token_count": 2485
} |
# Copyright 2024 Stanford University Team 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
#
#... | diffusers/src/diffusers/schedulers/scheduling_ddim_flax.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_ddim_flax.py",
"repo_id": "diffusers",
"token_count": 5537
} |
# Copyright 2024 Shuchen Xue, etc. in University of Chinese Academy of Sciences Team 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
#
# htt... | diffusers/src/diffusers/schedulers/scheduling_sasolver.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_sasolver.py",
"repo_id": "diffusers",
"token_count": 26440
} |
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class FlaxControlNetModel(metaclass=DummyObject):
_backends = ["flax"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["flax"])
@classmethod
def from_c... | diffusers/src/diffusers/utils/dummy_flax_objects.py/0 | {
"file_path": "diffusers/src/diffusers/utils/dummy_flax_objects.py",
"repo_id": "diffusers",
"token_count": 2343
} |
import os
import tempfile
from typing import Any, Callable, List, Optional, Tuple, Union
from urllib.parse import unquote, urlparse
import PIL.Image
import PIL.ImageOps
import requests
from .import_utils import BACKENDS_MAPPING, is_imageio_available
def load_image(
image: Union[str, PIL.Image.Image], convert_me... | diffusers/src/diffusers/utils/loading_utils.py/0 | {
"file_path": "diffusers/src/diffusers/utils/loading_utils.py",
"repo_id": "diffusers",
"token_count": 2302
} |
# Copyright 2024 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/hooks/test_hooks.py/0 | {
"file_path": "diffusers/tests/hooks/test_hooks.py",
"repo_id": "diffusers",
"token_count": 6203
} |
# coding=utf-8
# Copyright 2024 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_hunyuan_video.py/0 | {
"file_path": "diffusers/tests/models/autoencoders/test_models_autoencoder_hunyuan_video.py",
"repo_id": "diffusers",
"token_count": 2814
} |
# Copyright 2024 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/models/transformers/test_models_transformer_sana.py/0 | {
"file_path": "diffusers/tests/models/transformers/test_models_transformer_sana.py",
"repo_id": "diffusers",
"token_count": 1065
} |
# coding=utf-8
# Copyright 2024 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/others/test_config.py/0 | {
"file_path": "diffusers/tests/others/test_config.py",
"repo_id": "diffusers",
"token_count": 4259
} |
# coding=utf-8
# Copyright 2024 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_sdxl.py/0 | {
"file_path": "diffusers/tests/pipelines/controlnet/test_controlnet_sdxl.py",
"repo_id": "diffusers",
"token_count": 20666
} |
# coding=utf-8
# Copyright 2024 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/dance_diffusion/test_dance_diffusion.py/0 | {
"file_path": "diffusers/tests/pipelines/dance_diffusion/test_dance_diffusion.py",
"repo_id": "diffusers",
"token_count": 2496
} |
# coding=utf-8
# Copyright 2024 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/pag/test_pag_hunyuan_dit.py/0 | {
"file_path": "diffusers/tests/pipelines/pag/test_pag_hunyuan_dit.py",
"repo_id": "diffusers",
"token_count": 6402
} |
# These are canonical sets of parameters for different types of pipelines.
# They are set on subclasses of `PipelineTesterMixin` as `params` and
# `batch_params`.
#
# If a pipeline's set of arguments has minor changes from one of the common sets
# of arguments, do not make modifications to the existing common sets of a... | diffusers/tests/pipelines/pipeline_params.py/0 | {
"file_path": "diffusers/tests/pipelines/pipeline_params.py",
"repo_id": "diffusers",
"token_count": 1584
} |
# coding=utf-8
# Copyright 2024 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_2/test_stable_diffusion_depth.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py",
"repo_id": "diffusers",
"token_count": 8066
} |
# coding=utf-8
# Copyright 2024 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_xl/test_stable_diffusion_xl_adapter.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl_adapter.py",
"repo_id": "diffusers",
"token_count": 12814
} |
from diffusers.utils.testing_utils import require_onnxruntime
@require_onnxruntime
class OnnxPipelineTesterMixin:
"""
This mixin is designed to be used with unittest.TestCase classes.
It provides a set of common tests for each ONNXRuntime pipeline, e.g. saving and loading the pipeline,
equivalence of ... | diffusers/tests/pipelines/test_pipelines_onnx_common.py/0 | {
"file_path": "diffusers/tests/pipelines/test_pipelines_onnx_common.py",
"repo_id": "diffusers",
"token_count": 118
} |
import torch
from diffusers import TCDScheduler
from .test_schedulers import SchedulerCommonTest
class TCDSchedulerTest(SchedulerCommonTest):
scheduler_classes = (TCDScheduler,)
forward_default_kwargs = (("num_inference_steps", 10),)
def get_scheduler_config(self, **kwargs):
config = {
... | diffusers/tests/schedulers/test_scheduler_tcd.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_tcd.py",
"repo_id": "diffusers",
"token_count": 3098
} |
import gc
import unittest
import torch
from diffusers import (
StableDiffusionImg2ImgPipeline,
)
from diffusers.utils import load_image
from diffusers.utils.testing_utils import (
backend_empty_cache,
enable_full_determinism,
require_torch_accelerator,
slow,
torch_device,
)
from .single_file_... | diffusers/tests/single_file/test_stable_diffusion_img2img_single_file.py/0 | {
"file_path": "diffusers/tests/single_file/test_stable_diffusion_img2img_single_file.py",
"repo_id": "diffusers",
"token_count": 1604
} |
#!/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/benchmarks/video/run_video_benchmark.py/0 | {
"file_path": "lerobot/benchmarks/video/run_video_benchmark.py",
"repo_id": "lerobot",
"token_count": 8154
} |
#!/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/lerobot/__init__.py/0 | {
"file_path": "lerobot/lerobot/__init__.py",
"repo_id": "lerobot",
"token_count": 3253
} |
#!/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/lerobot/common/datasets/transforms.py/0 | {
"file_path": "lerobot/lerobot/common/datasets/transforms.py",
"repo_id": "lerobot",
"token_count": 3919
} |
#!/usr/bin/env python
# Copyright 2024 Tony Z. Zhao 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
#
# http://www.apache.org/licenses... | lerobot/lerobot/common/policies/act/modeling_act.py/0 | {
"file_path": "lerobot/lerobot/common/policies/act/modeling_act.py",
"repo_id": "lerobot",
"token_count": 15980
} |
#!/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/lerobot/common/policies/utils.py/0 | {
"file_path": "lerobot/lerobot/common/policies/utils.py",
"repo_id": "lerobot",
"token_count": 791
} |
"""Logic to calibrate a robot arm built with feetech motors"""
# TODO(rcadene, aliberts): move this logic into the robot code when refactoring
import time
import numpy as np
from lerobot.common.robot_devices.motors.feetech import (
CalibrationMode,
TorqueMode,
convert_degrees_to_steps,
)
from lerobot.com... | lerobot/lerobot/common/robot_devices/robots/feetech_calibration.py/0 | {
"file_path": "lerobot/lerobot/common/robot_devices/robots/feetech_calibration.py",
"repo_id": "lerobot",
"token_count": 7917
} |
"""
This script configure a single motor at a time to a given ID and baudrate.
Example of usage:
```bash
python lerobot/scripts/configure_motor.py \
--port /dev/tty.usbmodem585A0080521 \
--brand feetech \
--model sts3215 \
--baudrate 1000000 \
--ID 1
```
"""
import argparse
import time
def get_motor_bus_c... | lerobot/lerobot/scripts/configure_motor.py/0 | {
"file_path": "lerobot/lerobot/scripts/configure_motor.py",
"repo_id": "lerobot",
"token_count": 2848
} |
#!/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/tests/test_datasets.py/0 | {
"file_path": "lerobot/tests/test_datasets.py",
"repo_id": "lerobot",
"token_count": 7109
} |
<!--โ ๏ธ 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.
-->
# Configuration
[`PeftConfigMixin`] is the base configuration class for storing the adapter configuration of a [`PeftModel`], and [`PromptLearningCo... | peft/docs/source/package_reference/config.md/0 | {
"file_path": "peft/docs/source/package_reference/config.md",
"repo_id": "peft",
"token_count": 224
} |
<!--โ ๏ธ 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
} |
<!--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/examples/boft_controlnet/boft_controlnet.md/0 | {
"file_path": "peft/examples/boft_controlnet/boft_controlnet.md",
"repo_id": "peft",
"token_count": 2426
} |
<jupyter_start><jupyter_text>Training PEFT models with new tokens being added to the embedding layers and tokenizerIn this example, we will learn how to train a LoRA model when adding new tokens to the tokenizer and model. This is a common usecase when doing the following:1. Instruction finetuning with new tokens beind... | peft/examples/causal_language_modeling/peft_lora_clm_with_additional_tokens.ipynb/0 | {
"file_path": "peft/examples/causal_language_modeling/peft_lora_clm_with_additional_tokens.ipynb",
"repo_id": "peft",
"token_count": 4577
} |
# 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/examples/feature_extraction/peft_lora_embedding_semantic_search.py/0 | {
"file_path": "peft/examples/feature_extraction/peft_lora_embedding_semantic_search.py",
"repo_id": "peft",
"token_count": 8775
} |
<jupyter_start><jupyter_text>Using PEFT with timm `peft` allows us to train any model with LoRA as long as the layer type is supported. Since `Conv2D` is one of the supported layer types, it makes sense to test it on image models.In this short notebook, we will demonstrate this with an image classification task using [... | peft/examples/image_classification/image_classification_timm_peft_lora.ipynb/0 | {
"file_path": "peft/examples/image_classification/image_classification_timm_peft_lora.ipynb",
"repo_id": "peft",
"token_count": 3067
} |
<jupyter_start><jupyter_text>Using FourierFT for sequence classification In this example, we fine-tune Roberta (base) on a sequence classification task using FourierFT. Imports<jupyter_code># To run this notebook, please run `pip install evaluate` to install additional dependencies not covered by PEFT.
import torch
f... | peft/examples/sequence_classification/FourierFT.ipynb/0 | {
"file_path": "peft/examples/sequence_classification/FourierFT.ipynb",
"repo_id": "peft",
"token_count": 2571
} |
# 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/mapping_func.py/0 | {
"file_path": "peft/src/peft/mapping_func.py",
"repo_id": "peft",
"token_count": 2208
} |
# 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/adaption_prompt/layer.py/0 | {
"file_path": "peft/src/peft/tuners/adaption_prompt/layer.py",
"repo_id": "peft",
"token_count": 2705
} |
# 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/cpt/model.py/0 | {
"file_path": "peft/src/peft/tuners/cpt/model.py",
"repo_id": "peft",
"token_count": 3563
} |
# 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/ln_tuning/layer.py/0 | {
"file_path": "peft/src/peft/tuners/ln_tuning/layer.py",
"repo_id": "peft",
"token_count": 1852
} |
# 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/dora.py/0 | {
"file_path": "peft/src/peft/tuners/lora/dora.py",
"repo_id": "peft",
"token_count": 3424
} |
# 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/oft/config.py/0 | {
"file_path": "peft/src/peft/tuners/oft/config.py",
"repo_id": "peft",
"token_count": 4034
} |
# 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/prompt_tuning/model.py/0 | {
"file_path": "peft/src/peft/tuners/prompt_tuning/model.py",
"repo_id": "peft",
"token_count": 1486
} |
# 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/utils/__init__.py/0 | {
"file_path": "peft/src/peft/utils/__init__.py",
"repo_id": "peft",
"token_count": 1463
} |
# 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
} |
# 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_loraplus.py/0 | {
"file_path": "peft/tests/test_loraplus.py",
"repo_id": "peft",
"token_count": 1312
} |
#!/usr/bin/env python3
""" Checkpoint Cleaning Script
Takes training checkpoints with GPU tensors, optimizer state, extra dict keys, etc.
and outputs a CPU tensor checkpoint with only the `state_dict` along with SHA256
calculation for model zoo compatibility.
Hacked together by / Copyright 2020 Ross Wightman (https:... | pytorch-image-models/clean_checkpoint.py/0 | {
"file_path": "pytorch-image-models/clean_checkpoint.py",
"repo_id": "pytorch-image-models",
"token_count": 1771
} |
# RegNetX
**RegNetX** is a convolutional network design space with simple, regular models with parameters: depth \\( d \\), initial width \\( w_{0} > 0 \\), and slope \\( w_{a} > 0 \\), and generates a different block width \\( u_{j} \\) for each block \\( j < d \\). The key restriction for the RegNet types of model i... | pytorch-image-models/hfdocs/source/models/regnetx.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/regnetx.mdx",
"repo_id": "pytorch-image-models",
"token_count": 6565
} |
# Results
CSV files containing an ImageNet-1K and out-of-distribution (OOD) test set validation results for all models with pretrained weights is located in the repository [results folder](https://github.com/rwightman/pytorch-image-models/tree/master/results).
## Self-trained Weights
The table below includes ImageNe... | pytorch-image-models/hfdocs/source/results.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/results.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2259
} |
import logging
from .constants import *
_logger = logging.getLogger(__name__)
def resolve_data_config(
args=None,
pretrained_cfg=None,
model=None,
use_test_size=False,
verbose=False
):
assert model or args or pretrained_cfg, "At least one of model, args, or pretrained_cfg... | pytorch-image-models/timm/data/config.py/0 | {
"file_path": "pytorch-image-models/timm/data/config.py",
"repo_id": "pytorch-image-models",
"token_count": 1927
} |
""" Dataset reader for HF IterableDataset
"""
import math
import os
from itertools import repeat, chain
from typing import Optional
import torch
import torch.distributed as dist
from PIL import Image
try:
import datasets
from datasets.distributed import split_dataset_by_node
from datasets.splits import Sp... | pytorch-image-models/timm/data/readers/reader_hfids.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/reader_hfids.py",
"repo_id": "pytorch-image-models",
"token_count": 3798
} |
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
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
"""
fused_attn: torch.jit.Final[boo... | 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": 1795
} |
"""
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
} |
""" 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
} |
""" Depthwise Separable Conv Modules
Basic DWS convs. Other variations of DWS exist with batch norm or activations between the
DW and PW convs such as the Depthwise modules in MobileNetV2 / EfficientNet and Xception.
Hacked together by / Copyright 2020 Ross Wightman
"""
from torch import nn as nn
from .create_conv2d... | pytorch-image-models/timm/layers/separable_conv.py/0 | {
"file_path": "pytorch-image-models/timm/layers/separable_conv.py",
"repo_id": "pytorch-image-models",
"token_count": 1138
} |
import dataclasses
import logging
import os
from copy import deepcopy
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from torch import nn as nn
from torch.hub import load_state_dict_from_url
from timm.models._features import FeatureListNet, FeatureDictNet, FeatureHookNet... | pytorch-image-models/timm/models/_builder.py/0 | {
"file_path": "pytorch-image-models/timm/models/_builder.py",
"repo_id": "pytorch-image-models",
"token_count": 8732
} |
""" Model Registry
Hacked together by / Copyright 2020 Ross Wightman
"""
import fnmatch
import re
import sys
import warnings
from collections import defaultdict, deque
from copy import deepcopy
from dataclasses import replace
from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Sequence, Union, Tuple... | pytorch-image-models/timm/models/_registry.py/0 | {
"file_path": "pytorch-image-models/timm/models/_registry.py",
"repo_id": "pytorch-image-models",
"token_count": 5725
} |
""" EdgeNeXt
Paper: `EdgeNeXt: Efficiently Amalgamated CNN-Transformer Architecture for Mobile Vision Applications`
- https://arxiv.org/abs/2206.10589
Original code and weights from https://github.com/mmaaz60/EdgeNeXt
Modifications and additions for timm by / Copyright 2022, Ross Wightman
"""
import math
from funct... | pytorch-image-models/timm/models/edgenext.py/0 | {
"file_path": "pytorch-image-models/timm/models/edgenext.py",
"repo_id": "pytorch-image-models",
"token_count": 11055
} |
""" PP-HGNet (V1 & V2)
Reference:
https://github.com/PaddlePaddle/PaddleClas/blob/develop/docs/zh_CN/models/ImageNet1k/PP-HGNetV2.md
The Paddle Implement of PP-HGNet (https://github.com/PaddlePaddle/PaddleClas/blob/release/2.5.1/docs/en/models/PP-HGNet_en.md)
PP-HGNet: https://github.com/PaddlePaddle/PaddleClas/blob/r... | pytorch-image-models/timm/models/hgnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/hgnet.py",
"repo_id": "pytorch-image-models",
"token_count": 13177
} |
""" MobileViT
Paper:
V1: `MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer` - https://arxiv.org/abs/2110.02178
V2: `Separable Self-attention for Mobile Vision Transformers` - https://arxiv.org/abs/2206.02680
MobileVitBlock and checkpoints adapted from https://github.com/apple/ml-cvnets... | pytorch-image-models/timm/models/mobilevit.py/0 | {
"file_path": "pytorch-image-models/timm/models/mobilevit.py",
"repo_id": "pytorch-image-models",
"token_count": 12812
} |
"""PyTorch ResNet
This started as a copy of https://github.com/pytorch/vision 'resnet.py' (BSD-3-Clause) with
additional dropout and dynamic global avg/max pool.
ResNeXt, SE-ResNeXt, SENet, and MXNet Gluon stem/downsample variants, tiered stems added by Ross Wightman
Copyright 2019, Ross Wightman
"""
import math
fro... | pytorch-image-models/timm/models/resnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/resnet.py",
"repo_id": "pytorch-image-models",
"token_count": 45896
} |
""" Vision Transformer (ViT) in PyTorch
A PyTorch implement of Vision Transformers as described in:
'An Image Is Worth 16 x 16 Words: Transformers for Image Recognition at Scale'
- https://arxiv.org/abs/2010.11929
`How to train your ViT? Data, Augmentation, and Regularization in Vision Transformers`
- https:... | pytorch-image-models/timm/models/vision_transformer.py/0 | {
"file_path": "pytorch-image-models/timm/models/vision_transformer.py",
"repo_id": "pytorch-image-models",
"token_count": 79510
} |
""" Adafactor (Big Vision variant) for PyTorch
Adapted from the implementation in big vision: https://github.com/google-research/big_vision
Described in 'Scaling Vision Transformers': https://arxiv.org/abs/2106.04560
Adaptation and PyTorch modifications by Ross Wightman
"""
from typing import List, Optional, Tuple, ... | pytorch-image-models/timm/optim/adafactor_bv.py/0 | {
"file_path": "pytorch-image-models/timm/optim/adafactor_bv.py",
"repo_id": "pytorch-image-models",
"token_count": 6213
} |
""" Nvidia NovoGrad Optimizer.
Original impl by Nvidia from Jasper example:
- https://github.com/NVIDIA/DeepLearningExamples/blob/master/PyTorch/SpeechRecognition/Jasper
Paper: `Stochastic Gradient Methods with Layer-wise Adaptive Moments for Training of Deep Networks`
- https://arxiv.org/abs/1905.11286
"""
im... | pytorch-image-models/timm/optim/nvnovograd.py/0 | {
"file_path": "pytorch-image-models/timm/optim/nvnovograd.py",
"repo_id": "pytorch-image-models",
"token_count": 2509
} |
from .agc import adaptive_clip_grad
from .attention_extract import AttentionExtract
from .checkpoint_saver import CheckpointSaver
from .clip_grad import dispatch_clip_grad
from .cuda import ApexScaler, NativeScaler
from .decay_batch import decay_batch_step, check_batch_size_retry
from .distributed import distribute_bn,... | pytorch-image-models/timm/utils/__init__.py/0 | {
"file_path": "pytorch-image-models/timm/utils/__init__.py",
"repo_id": "pytorch-image-models",
"token_count": 264
} |
""" Summary utilities
Hacked together by / Copyright 2020 Ross Wightman
"""
import csv
import os
from collections import OrderedDict
try:
import wandb
except ImportError:
pass
def get_outdir(path, *paths, inc=False):
outdir = os.path.join(path, *paths)
if not os.path.exists(outdir):
os.maked... | pytorch-image-models/timm/utils/summary.py/0 | {
"file_path": "pytorch-image-models/timm/utils/summary.py",
"repo_id": "pytorch-image-models",
"token_count": 633
} |
<!--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... | smolagents/docs/source/en/tutorials/secure_code_execution.md/0 | {
"file_path": "smolagents/docs/source/en/tutorials/secure_code_execution.md",
"repo_id": "smolagents",
"token_count": 1304
} |
<!--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... | smolagents/docs/source/hi/tutorials/tools.md/0 | {
"file_path": "smolagents/docs/source/hi/tutorials/tools.md",
"repo_id": "smolagents",
"token_count": 10845
} |
# This is a config for E2B sandbox template.
# You can use template ID (qywp2ctmu2q7jzprcf4j) to create a sandbox:
# Python SDK
# from e2b import Sandbox, AsyncSandbox
# sandbox = Sandbox("qywp2ctmu2q7jzprcf4j") # Sync sandbox
# sandbox = await AsyncSandbox.create("qywp2ctmu2q7jzprcf4j") # Async sandbox
# JS SDK
# im... | smolagents/e2b.toml/0 | {
"file_path": "smolagents/e2b.toml",
"repo_id": "smolagents",
"token_count": 254
} |
from typing import Optional
from smolagents import Tool
from smolagents.models import MessageRole, Model
from .mdconvert import MarkdownConverter
class TextInspectorTool(Tool):
name = "inspect_file_as_text"
description = """
You cannot load files yourself: instead call this tool to read a file as markdown t... | smolagents/examples/open_deep_research/scripts/text_inspector_tool.py/0 | {
"file_path": "smolagents/examples/open_deep_research/scripts/text_inspector_tool.py",
"repo_id": "smolagents",
"token_count": 2300
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.