text stringlengths 7 318k | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 439 |
|---|---|---|---|
<!--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... | diffusers/docs/source/en/using-diffusers/unconditional_image_generation.md/0 | {
"file_path": "diffusers/docs/source/en/using-diffusers/unconditional_image_generation.md",
"repo_id": "diffusers",
"token_count": 636
} | 93 |
<!--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... | diffusers/docs/source/ko/optimization/coreml.md/0 | {
"file_path": "diffusers/docs/source/ko/optimization/coreml.md",
"repo_id": "diffusers",
"token_count": 8286
} | 94 |
# ์ฌ๋ฌ GPU๋ฅผ ์ฌ์ฉํ ๋ถ์ฐ ์ถ๋ก
๋ถ์ฐ ์ค์ ์์๋ ์ฌ๋ฌ ๊ฐ์ ํ๋กฌํํธ๋ฅผ ๋์์ ์์ฑํ ๋ ์ ์ฉํ ๐ค [Accelerate](https://huggingface.co/docs/accelerate/index) ๋๋ [PyTorch Distributed](https://pytorch.org/tutorials/beginner/dist_overview.html)๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ๋ฌ GPU์์ ์ถ๋ก ์ ์คํํ ์ ์์ต๋๋ค.
์ด ๊ฐ์ด๋์์๋ ๋ถ์ฐ ์ถ๋ก ์ ์ํด ๐ค Accelerate์ PyTorch Distributed๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ๋๋ฆฝ๋๋ค.
## ๐ค Acceler... | diffusers/docs/source/ko/training/distributed_inference.md/0 | {
"file_path": "diffusers/docs/source/ko/training/distributed_inference.md",
"repo_id": "diffusers",
"token_count": 2604
} | 95 |
<!--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... | diffusers/docs/source/ko/using-diffusers/depth2img.md/0 | {
"file_path": "diffusers/docs/source/ko/using-diffusers/depth2img.md",
"repo_id": "diffusers",
"token_count": 1377
} | 96 |
- sections:
- local: index
title: ๐งจ Diffusers
- local: quicktour
title: Tour rรกpido
- local: installation
title: Instalaรงรฃo
title: Primeiros passos
| diffusers/docs/source/pt/_toctree.yml/0 | {
"file_path": "diffusers/docs/source/pt/_toctree.yml",
"repo_id": "diffusers",
"token_count": 77
} | 97 |
import glob
import os
from typing import Dict, List, Union
import safetensors.torch
import torch
from huggingface_hub import snapshot_download
from huggingface_hub.utils import validate_hf_hub_args
from diffusers import DiffusionPipeline, __version__
from diffusers.schedulers.scheduling_utils import SCHEDULER_CONFIG_... | diffusers/examples/community/checkpoint_merger.py/0 | {
"file_path": "diffusers/examples/community/checkpoint_merger.py",
"repo_id": "diffusers",
"token_count": 6070
} | 98 |
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, LoraLoaderMixin, TextualInve... | diffusers/examples/community/latent_consistency_interpolate.py/0 | {
"file_path": "diffusers/examples/community/latent_consistency_interpolate.py",
"repo_id": "diffusers",
"token_count": 23232
} | 99 |
# Copyright 2023 FABRIC 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 re... | diffusers/examples/community/pipeline_fabric.py/0 | {
"file_path": "diffusers/examples/community/pipeline_fabric.py",
"repo_id": "diffusers",
"token_count": 16488
} | 100 |
from typing import Callable, List, Optional, Union
import PIL.Image
import torch
from transformers import (
CLIPImageProcessor,
CLIPSegForImageSegmentation,
CLIPSegProcessor,
CLIPTextModel,
CLIPTokenizer,
)
from diffusers import DiffusionPipeline
from diffusers.configuration_utils import FrozenDic... | diffusers/examples/community/text_inpainting.py/0 | {
"file_path": "diffusers/examples/community/text_inpainting.py",
"repo_id": "diffusers",
"token_count": 6667
} | 101 |
# ControlNet training example for Stable Diffusion XL (SDXL)
The `train_controlnet_sdxl.py` script shows how to implement the ControlNet training procedure and adapt it for [Stable Diffusion XL](https://huggingface.co/papers/2307.01952).
## Running locally with PyTorch
### Installing the dependencies
Before running... | diffusers/examples/controlnet/README_sdxl.md/0 | {
"file_path": "diffusers/examples/controlnet/README_sdxl.md",
"repo_id": "diffusers",
"token_count": 1519
} | 102 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2023 Harutatsu Akiyama 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.... | diffusers/examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py/0 | {
"file_path": "diffusers/examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py",
"repo_id": "diffusers",
"token_count": 23213
} | 103 |
#!/usr/bin/env python
# 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/LI... | diffusers/examples/research_projects/consistency_training/train_cm_ct_unconditional.py/0 | {
"file_path": "diffusers/examples/research_projects/consistency_training/train_cm_ct_unconditional.py",
"repo_id": "diffusers",
"token_count": 26171
} | 104 |
import torch.nn as nn
from torchvision.models import efficientnet_v2_l, efficientnet_v2_s
from diffusers.configuration_utils import ConfigMixin, register_to_config
from diffusers.models.modeling_utils import ModelMixin
class EfficientNetEncoder(ModelMixin, ConfigMixin):
@register_to_config
def __init__(self,... | diffusers/examples/wuerstchen/text_to_image/modeling_efficient_net_encoder.py/0 | {
"file_path": "diffusers/examples/wuerstchen/text_to_image/modeling_efficient_net_encoder.py",
"repo_id": "diffusers",
"token_count": 374
} | 105 |
import argparse
import json
import torch
from diffusers import AutoencoderKL, DDPMPipeline, DDPMScheduler, UNet2DModel, VQModel
def shave_segments(path, n_shave_prefix_segments=1):
"""
Removes segments. Positive values shave the first segments, negative shave the last segments.
"""
if n_shave_prefix... | diffusers/scripts/convert_ddpm_original_checkpoint_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_ddpm_original_checkpoint_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 8490
} | 106 |
#!/usr/bin/env python3
import argparse
import os
import jax as jnp
import numpy as onp
import torch
import torch.nn as nn
from music_spectrogram_diffusion import inference
from t5x import checkpoints
from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline
from diffusers.pipelines.spectrogr... | diffusers/scripts/convert_music_spectrogram_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_music_spectrogram_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 4469
} | 107 |
# 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
} | 108 |
# THIS FILE HAS BEEN AUTOGENERATED. To update:
# 1. modify the `_deps` dict in setup.py
# 2. run `make deps_table_update`
deps = {
"Pillow": "Pillow",
"accelerate": "accelerate>=0.11.0",
"compel": "compel==0.1.8",
"datasets": "datasets",
"filelock": "filelock",
"flax": "flax>=0.4.1",
"hf-doc... | diffusers/src/diffusers/dependency_versions_table.py/0 | {
"file_path": "diffusers/src/diffusers/dependency_versions_table.py",
"repo_id": "diffusers",
"token_count": 789
} | 109 |
# 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/loaders/unet.py/0 | {
"file_path": "diffusers/src/diffusers/loaders/unet.py",
"repo_id": "diffusers",
"token_count": 18810
} | 110 |
# 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/models/controlnet.py/0 | {
"file_path": "diffusers/src/diffusers/models/controlnet.py",
"repo_id": "diffusers",
"token_count": 18789
} | 111 |
# 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/models/t5_film_transformer.py/0 | {
"file_path": "diffusers/src/diffusers/models/t5_film_transformer.py",
"repo_id": "diffusers",
"token_count": 1344
} | 112 |
# 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/models/unets/unet_1d_blocks.py/0 | {
"file_path": "diffusers/src/diffusers/models/unets/unet_1d_blocks.py",
"repo_id": "diffusers",
"token_count": 12024
} | 113 |
# coding=utf-8
# Copyright 2023 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/optimization.py/0 | {
"file_path": "diffusers/src/diffusers/optimization.py",
"repo_id": "diffusers",
"token_count": 5888
} | 114 |
# coding=utf-8
# Copyright 2023 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": 20667
} | 115 |
# 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/controlnet/pipeline_controlnet_sd_xl_img2img.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py",
"repo_id": "diffusers",
"token_count": 37327
} | 116 |
import numpy as np
import torch
import torch.nn as nn
from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel
from ...utils import logging
logger = logging.get_logger(__name__)
class IFSafetyChecker(PreTrainedModel):
config_class = CLIPConfig
_no_split_modules = ["CLIPEncoderLa... | diffusers/src/diffusers/pipelines/deepfloyd_if/safety_checker.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/deepfloyd_if/safety_checker.py",
"repo_id": "diffusers",
"token_count": 913
} | 117 |
# Copyright 2023 Pix2Pix Zero 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
#
# Unl... | diffusers/src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_pix2pix_zero.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_pix2pix_zero.py",
"repo_id": "diffusers",
"token_count": 28101
} | 118 |
# 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/kandinsky/pipeline_kandinsky.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py",
"repo_id": "diffusers",
"token_count": 7950
} | 119 |
# coding=utf-8
# Copyright 2023 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/stable_diffusion/convert_from_ckpt.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py",
"repo_id": "diffusers",
"token_count": 36006
} | 120 |
# 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/stable_diffusion/pipeline_stable_diffusion_upscale.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py",
"repo_id": "diffusers",
"token_count": 18168
} | 121 |
# Copyright 2023 Harutatsu Akiyama 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/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_instruct_pix2pix.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_instruct_pix2pix.py",
"repo_id": "diffusers",
"token_count": 24082
} | 122 |
# Copyright 2023 Kakao Brain 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 requi... | diffusers/src/diffusers/pipelines/unclip/text_proj.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/unclip/text_proj.py",
"repo_id": "diffusers",
"token_count": 1638
} | 123 |
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/schedulers/deprecated/__init__.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/deprecated/__init__.py",
"repo_id": "diffusers",
"token_count": 555
} | 124 |
# Copyright 2023 TSAIL 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 requir... | diffusers/src/diffusers/schedulers/scheduling_dpmsolver_multistep_flax.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_dpmsolver_multistep_flax.py",
"repo_id": "diffusers",
"token_count": 13616
} | 125 |
# Copyright 2023 Zhejiang 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_pndm_flax.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_pndm_flax.py",
"repo_id": "diffusers",
"token_count": 9658
} | 126 |
# 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
} | 127 |
import os
from typing import Callable, Union
import PIL.Image
import PIL.ImageOps
import requests
def load_image(
image: Union[str, PIL.Image.Image], convert_method: Callable[[PIL.Image.Image], PIL.Image.Image] = None
) -> PIL.Image.Image:
"""
Loads `image` to a PIL Image.
Args:
image (`str`... | diffusers/src/diffusers/utils/loading_utils.py/0 | {
"file_path": "diffusers/src/diffusers/utils/loading_utils.py",
"repo_id": "diffusers",
"token_count": 631
} | 128 |
# coding=utf-8
# Copyright 2023 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/lora/test_peft_lora_in_non_peft.py/0 | {
"file_path": "diffusers/tests/lora/test_peft_lora_in_non_peft.py",
"repo_id": "diffusers",
"token_count": 1114
} | 129 |
# coding=utf-8
# Copyright 2023 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/unets/test_models_unet_2d_condition.py/0 | {
"file_path": "diffusers/tests/models/unets/test_models_unet_2d_condition.py",
"repo_id": "diffusers",
"token_count": 23036
} | 130 |
# coding=utf-8
# Copyright 2023 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_utils.py/0 | {
"file_path": "diffusers/tests/others/test_utils.py",
"repo_id": "diffusers",
"token_count": 3327
} | 131 |
import gc
import unittest
import numpy as np
import torch
from torch.backends.cuda import sdp_kernel
from diffusers import (
CMStochasticIterativeScheduler,
ConsistencyModelPipeline,
UNet2DModel,
)
from diffusers.utils.testing_utils import (
enable_full_determinism,
nightly,
require_torch_2,
... | diffusers/tests/pipelines/consistency_models/test_consistency_models.py/0 | {
"file_path": "diffusers/tests/pipelines/consistency_models/test_consistency_models.py",
"repo_id": "diffusers",
"token_count": 4999
} | 132 |
import tempfile
import numpy as np
import torch
from transformers import AutoTokenizer, T5EncoderModel
from diffusers import DDPMScheduler, UNet2DConditionModel
from diffusers.models.attention_processor import AttnAddedKVProcessor
from diffusers.pipelines.deepfloyd_if import IFWatermarker
from diffusers.utils.testing... | diffusers/tests/pipelines/deepfloyd_if/__init__.py/0 | {
"file_path": "diffusers/tests/pipelines/deepfloyd_if/__init__.py",
"repo_id": "diffusers",
"token_count": 4583
} | 133 |
import gc
import inspect
import random
import unittest
import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
LatentConsistencyModelImg2ImgPipeline,
LCMScheduler,
UNet2DConditionModel,
)
from diffusers.utils.testing_... | diffusers/tests/pipelines/latent_consistency_models/test_latent_consistency_models_img2img.py/0 | {
"file_path": "diffusers/tests/pipelines/latent_consistency_models/test_latent_consistency_models_img2img.py",
"repo_id": "diffusers",
"token_count": 4946
} | 134 |
# coding=utf-8
# Copyright 2023 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/semantic_stable_diffusion/test_semantic_diffusion.py/0 | {
"file_path": "diffusers/tests/pipelines/semantic_stable_diffusion/test_semantic_diffusion.py",
"repo_id": "diffusers",
"token_count": 9605
} | 135 |
# coding=utf-8
# Copyright 2023 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": 11025
} | 136 |
# coding=utf-8
# Copyright 2023 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_k_diffusion.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl_k_diffusion.py",
"repo_id": "diffusers",
"token_count": 2097
} | 137 |
# coding=utf-8
# Copyright 2023 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/text_to_video_synthesis/test_text_to_video_zero_sdxl.py/0 | {
"file_path": "diffusers/tests/pipelines/text_to_video_synthesis/test_text_to_video_zero_sdxl.py",
"repo_id": "diffusers",
"token_count": 7188
} | 138 |
import torch
from diffusers import DDPMScheduler
from .test_schedulers import SchedulerCommonTest
class DDPMSchedulerTest(SchedulerCommonTest):
scheduler_classes = (DDPMScheduler,)
def get_scheduler_config(self, **kwargs):
config = {
"num_train_timesteps": 1000,
"beta_start"... | diffusers/tests/schedulers/test_scheduler_ddpm.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_ddpm.py",
"repo_id": "diffusers",
"token_count": 3860
} | 139 |
import tempfile
import torch
from diffusers import PNDMScheduler
from .test_schedulers import SchedulerCommonTest
class PNDMSchedulerTest(SchedulerCommonTest):
scheduler_classes = (PNDMScheduler,)
forward_default_kwargs = (("num_inference_steps", 50),)
def get_scheduler_config(self, **kwargs):
... | diffusers/tests/schedulers/test_scheduler_pndm.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_pndm.py",
"repo_id": "diffusers",
"token_count": 4654
} | 140 |
# Introduction
<CourseFloatingBanner
unit={0}
classNames="absolute z-10 right-0 top-0"
/>
## Bienvenue au cours sur les modรจles de diffusion ๐ค !
## ร quoi s'attendre ?
In this free course, you will:
- ๐ฉโ๐ Study the theory behind diffusion models
- ๐งจ Learn how to generate images and audio with the popula... | diffusion-models-class/units/fr/unit0/1.mdx/0 | {
"file_path": "diffusion-models-class/units/fr/unit0/1.mdx",
"repo_id": "diffusion-models-class",
"token_count": 1801
} | 141 |
<jupyter_start><jupyter_text>Prรฉparer des donnรฉes (TensorFlow) Installez les bibliothรจques ๐ค *Transformers* et ๐ค *Datasets* pour exรฉcuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece]
import tensorflow as tf
import numpy as np
from transformers import AutoTokenizer, TFAutoModelForSequ... | notebooks/course/fr/chapter3/section2_tf.ipynb/0 | {
"file_path": "notebooks/course/fr/chapter3/section2_tf.ipynb",
"repo_id": "notebooks",
"token_count": 1005
} | 142 |
<jupyter_start><jupyter_text>Les pouvoirs spรฉciaux des *tokenizers* rapides (PyTorch) Installez les bibliothรจques ๐ค *Transformers* et ๐ค *Datasets* pour exรฉcuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece]
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrain... | notebooks/course/fr/chapter6/section3_pt.ipynb/0 | {
"file_path": "notebooks/course/fr/chapter6/section3_pt.ipynb",
"repo_id": "notebooks",
"token_count": 1610
} | 143 |
<jupyter_start><jupyter_text>Rรฉsumรฉ (TensorFlow) Installez les bibliothรจques ๐ค *Datasets* et ๐ค *Transformers* pour exรฉcuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece]
!apt install git-lfs<jupyter_output><empty_output><jupyter_text>Vous aurez besoin de configurer git, adaptez votre e... | notebooks/course/fr/chapter7/section5_tf.ipynb/0 | {
"file_path": "notebooks/course/fr/chapter7/section5_tf.ipynb",
"repo_id": "notebooks",
"token_count": 3014
} | 144 |
<jupyter_start><jupyter_text>Introduction aux Blocks Installez les bibliothรจques ๐ค Transformers et ๐ค Gradio pour exรฉcuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece]
!pip install gradio
import gradio as gr
def flip_text(x):
return x[::-1]
demo = gr.Blocks()
with demo:
gr.... | notebooks/course/fr/chapter9/section7.ipynb/0 | {
"file_path": "notebooks/course/fr/chapter9/section7.ipynb",
"repo_id": "notebooks",
"token_count": 1332
} | 145 |
<jupyter_start><jupyter_text>InstructPix2Pix: Learning to Follow Image Editing InstructionsA demo notebook for [InstructPix2Pix](https://www.timothybrooks.com/instruct-pix2pix/) using [diffusers](https://github.com/huggingface/diffusers). InstructPix2Pix is fine-tuned stable diffusion model which allows you to edit ima... | notebooks/diffusers/InstructPix2Pix_using_diffusers.ipynb/0 | {
"file_path": "notebooks/diffusers/InstructPix2Pix_using_diffusers.ipynb",
"repo_id": "notebooks",
"token_count": 3610
} | 146 |
<jupyter_start><jupyter_text>Dreambooth fine-tuning for Stable Diffusion using d๐งจffusers This notebook shows how to "teach" Stable Diffusion a new concept via Dreambooth using ๐ค Hugging Face [๐งจ Diffusers library](https://github.com/huggingface/diffusers). _By using just 3-5 images you can teach new concepts to Stabl... | notebooks/diffusers/sd_dreambooth_training.ipynb/0 | {
"file_path": "notebooks/diffusers/sd_dreambooth_training.ipynb",
"repo_id": "notebooks",
"token_count": 11907
} | 147 |
#!/bin/bash
#SBATCH --job-name=idefics_zero3_finetuning_multinode # name
#SBATCH --nodes=2 # nodes
#SBATCH --ntasks-per-node=1 # crucial - only 1 task per dist per node!
#SBATCH --cpus-per-task=96 # number of cores per tasks
#SBATCH --gres=gpu:8 # number of gp... | notebooks/examples/idefics/idefics_zero3_finetuning/slurm_script_idefics_zero3_finetuning_multinode.slurm/0 | {
"file_path": "notebooks/examples/idefics/idefics_zero3_finetuning/slurm_script_idefics_zero3_finetuning_multinode.slurm",
"repo_id": "notebooks",
"token_count": 389
} | 148 |
<jupyter_start><jupyter_text>Protein Folding with ESMFold and ๐ค`transformers` ESMFold ([paper link](https://www.biorxiv.org/content/10.1101/2022.07.20.500902v2)) is a recently released protein folding model from FAIR. Unlike other protein folding models, it does not require external databases or search tools to predic... | notebooks/examples/protein_folding.ipynb/0 | {
"file_path": "notebooks/examples/protein_folding.ipynb",
"repo_id": "notebooks",
"token_count": 6321
} | 149 |
from transformers import ViTForImageClassification, Trainer, TrainingArguments,default_data_collator,ViTFeatureExtractor
from datasets import load_from_disk,load_metric
import random
import logging
import sys
import argparse
import os
import numpy as np
import subprocess
subprocess.run([
"git",
"config... | notebooks/sagemaker/09_image_classification_vision_transformer/scripts/train.py/0 | {
"file_path": "notebooks/sagemaker/09_image_classification_vision_transformer/scripts/train.py",
"repo_id": "notebooks",
"token_count": 2150
} | 150 |
<jupyter_start><jupyter_text>Hugging Face Transformers BERT fine-tuning using Amazon SageMaker and Training Compiler Compile and fine-tune a Multi-Class Classification Transformers with `Trainer` and `emotion` dataset using Amazon SageMaker Training Compiler Introduction SageMaker Training Compiler Overview[SageMaker ... | notebooks/sagemaker/15_training_compiler/sagemaker-notebook.ipynb/0 | {
"file_path": "notebooks/sagemaker/15_training_compiler/sagemaker-notebook.ipynb",
"repo_id": "notebooks",
"token_count": 3361
} | 151 |
<jupyter_start><jupyter_text>Automatic Speech Recogntion with Hugging Face's Transformers & Amazon SageMaker Transformer models are changing the world of machine learning, starting with natural language processing, and now, with audio and computer vision. Hugging Face's mission is to democratize good machine learning ... | notebooks/sagemaker/20_automatic_speech_recognition_inference/sagemaker-notebook.ipynb/0 | {
"file_path": "notebooks/sagemaker/20_automatic_speech_recognition_inference/sagemaker-notebook.ipynb",
"repo_id": "notebooks",
"token_count": 2639
} | 152 |
<jupyter_start><jupyter_text>How to deploy Large Language Models (LLMs) to Amazon SageMaker using new Hugging Face LLM DLCThis is an example on how to deploy the open-source LLMs, like [BLOOM](bigscience/bloom) to Amazon SageMaker for inference using the new Hugging Face LLM Inference Container. We will deploy the 12B ... | notebooks/sagemaker/27_deploy_large_language_models/sagemaker-notebook.ipynb/0 | {
"file_path": "notebooks/sagemaker/27_deploy_large_language_models/sagemaker-notebook.ipynb",
"repo_id": "notebooks",
"token_count": 4572
} | 153 |
<!--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/contributing.md/0 | {
"file_path": "peft/docs/source/developer_guides/contributing.md",
"repo_id": "peft",
"token_count": 1510
} | 154 |
<!--โ ๏ธ 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.
-->
# LoRA for semantic similarity tasks
Low-Rank Adaptation (LoRA) is a reparametrization method that aims to reduce the number of trainable parameters... | peft/docs/source/task_guides/semantic-similarity-lora.md/0 | {
"file_path": "peft/docs/source/task_guides/semantic-similarity-lora.md",
"repo_id": "peft",
"token_count": 5002
} | 155 |
<jupyter_start><jupyter_code>from transformers import AutoModelForSeq2SeqLM
from peft import get_peft_config, get_peft_model, get_peft_model_state_dict, LoraConfig, TaskType
import torch
from datasets import load_dataset
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
from transformers import AutoTokenizer
fr... | peft/examples/conditional_generation/peft_lora_seq2seq.ipynb/0 | {
"file_path": "peft/examples/conditional_generation/peft_lora_seq2seq.ipynb",
"repo_id": "peft",
"token_count": 2336
} | 156 |
<jupyter_start><jupyter_text>Fine-tune large models using ๐ค `peft` adapters, `transformers` & `bitsandbytes`In this tutorial we will cover how we can fine-tune large language models using the very recent `peft` library and `bitsandbytes` for loading large models in 8-bit.The fine-tuning method will rely on a recent me... | peft/examples/int8_training/Finetune_opt_bnb_peft.ipynb/0 | {
"file_path": "peft/examples/int8_training/Finetune_opt_bnb_peft.ipynb",
"repo_id": "peft",
"token_count": 2723
} | 157 |
<jupyter_start><jupyter_text>Using PEFT with custom models `peft` allows us to fine-tune models efficiently with LoRA. In this short notebook, we will demonstrate how to train a simple multilayer perceptron (MLP) using `peft`. Imports Make sure that you have the latest version of `peft` installed. To ensure that, run ... | peft/examples/multilayer_perceptron/multilayer_perceptron_lora.ipynb/0 | {
"file_path": "peft/examples/multilayer_perceptron/multilayer_perceptron_lora.ipynb",
"repo_id": "peft",
"token_count": 4094
} | 158 |
# flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all
# coding=utf-8
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not u... | peft/src/peft/tuners/__init__.py/0 | {
"file_path": "peft/src/peft/tuners/__init__.py",
"repo_id": "peft",
"token_count": 443
} | 159 |
# 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
#
# Unless required by ap... | peft/src/peft/tuners/ia3/model.py/0 | {
"file_path": "peft/src/peft/tuners/ia3/model.py",
"repo_id": "peft",
"token_count": 7054
} | 160 |
# 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
#
# Unless required by ap... | peft/src/peft/tuners/lycoris_utils.py/0 | {
"file_path": "peft/src/peft/tuners/lycoris_utils.py",
"repo_id": "peft",
"token_count": 6858
} | 161 |
# 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
#
# Unless required by ap... | peft/src/peft/tuners/poly/model.py/0 | {
"file_path": "peft/src/peft/tuners/poly/model.py",
"repo_id": "peft",
"token_count": 2931
} | 162 |
# 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
#
# Unless required by ap... | peft/tests/conftest.py/0 | {
"file_path": "peft/tests/conftest.py",
"repo_id": "peft",
"token_count": 363
} | 163 |
# 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
#
# Unless required by ap... | peft/tests/test_multitask_prompt_tuning.py/0 | {
"file_path": "peft/tests/test_multitask_prompt_tuning.py",
"repo_id": "peft",
"token_count": 4478
} | 164 |
#!/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
} | 165 |
# CSP-DarkNet
**CSPDarknet53** is a convolutional neural network and backbone for object detection that uses [DarkNet-53](https://paperswithcode.com/method/darknet-53). It employs a CSPNet strategy to partition the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The u... | pytorch-image-models/docs/models/.templates/models/csp-darknet.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/csp-darknet.md",
"repo_id": "pytorch-image-models",
"token_count": 947
} | 166 |
# (Gluon) 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.
The weights from this... | pytorch-image-models/docs/models/.templates/models/gloun-seresnext.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/gloun-seresnext.md",
"repo_id": "pytorch-image-models",
"token_count": 1705
} | 167 |
# PNASNet
**Progressive Neural Architecture Search**, or **PNAS**, is a method for learning the structure of convolutional neural networks (CNNs). It uses a sequential model-based optimization (SMBO) strategy, where we search the space of cell structures, starting with simple (shallow) models and progressing to comple... | pytorch-image-models/docs/models/.templates/models/pnasnet.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/pnasnet.md",
"repo_id": "pytorch-image-models",
"token_count": 813
} | 168 |
# SSL ResNet
**Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residual b... | pytorch-image-models/docs/models/.templates/models/ssl-resnet.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/ssl-resnet.md",
"repo_id": "pytorch-image-models",
"token_count": 1616
} | 169 |
# Scripts
A train, validation, inference, and checkpoint cleaning script included in the github root folder. Scripts are not currently packaged in the pip release.
The training and validation scripts evolved from early versions of the [PyTorch Imagenet Examples](https://github.com/pytorch/examples). I have added signi... | pytorch-image-models/docs/scripts.md/0 | {
"file_path": "pytorch-image-models/docs/scripts.md",
"repo_id": "pytorch-image-models",
"token_count": 511
} | 170 |
# Deep Layer Aggregation
Extending โshallowโ skip connections, **Dense Layer Aggregation (DLA)** incorporates more depth and sharing. The authors introduce two structures for deep layer aggregation (DLA): iterative deep aggregation (IDA) and hierarchical deep aggregation (HDA). These structures are expressed through ... | pytorch-image-models/hfdocs/source/models/dla.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/dla.mdx",
"repo_id": "pytorch-image-models",
"token_count": 6758
} | 171 |
# Res2NeXt
**Res2NeXt** is an image model that employs a variation on [ResNeXt](https://paperswithcode.com/method/resnext) bottleneck residual blocks. The motivation is to be able to represent features at multiple scales. This is achieved through a novel building block for CNNs that constructs hierarchical residual-li... | pytorch-image-models/hfdocs/source/models/res2next.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/res2next.mdx",
"repo_id": "pytorch-image-models",
"token_count": 1711
} | 172 |
#!/usr/bin/env python3
"""PyTorch Inference Script
An example inference script that outputs top-k class ids for images in a folder into a csv.
Hacked together by / Copyright 2020 Ross Wightman (https://github.com/rwightman)
"""
import argparse
import json
import logging
import os
import time
from contextlib import su... | pytorch-image-models/inference.py/0 | {
"file_path": "pytorch-image-models/inference.py",
"repo_id": "pytorch-image-models",
"token_count": 6803
} | 173 |
[dist_conda]
conda_name_differences = 'torch:pytorch'
channels = pytorch
noarch = True
| pytorch-image-models/setup.cfg/0 | {
"file_path": "pytorch-image-models/setup.cfg",
"repo_id": "pytorch-image-models",
"token_count": 37
} | 174 |
""" Dataset Factory
Hacked together by / Copyright 2021, Ross Wightman
"""
import os
from typing import Optional
from torchvision.datasets import CIFAR100, CIFAR10, MNIST, KMNIST, FashionMNIST, ImageFolder
try:
from torchvision.datasets import Places365
has_places365 = True
except ImportError:
has_places3... | pytorch-image-models/timm/data/dataset_factory.py/0 | {
"file_path": "pytorch-image-models/timm/data/dataset_factory.py",
"repo_id": "pytorch-image-models",
"token_count": 3864
} | 175 |
""" A dataset reader that reads single tarfile based datasets
This reader can read datasets consisting if a single tarfile containing images.
I am planning to deprecated it in favour of ParerImageInTar.
Hacked together by / Copyright 2020 Ross Wightman
"""
import os
import tarfile
from timm.utils.misc import natural... | pytorch-image-models/timm/data/readers/reader_image_tar.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/reader_image_tar.py",
"repo_id": "pytorch-image-models",
"token_count": 1071
} | 176 |
""" Bottleneck Self Attention (Bottleneck Transformers)
Paper: `Bottleneck Transformers for Visual Recognition` - https://arxiv.org/abs/2101.11605
@misc{2101.11605,
Author = {Aravind Srinivas and Tsung-Yi Lin and Niki Parmar and Jonathon Shlens and Pieter Abbeel and Ashish Vaswani},
Title = {Bottleneck Transformers f... | pytorch-image-models/timm/layers/bottleneck_attn.py/0 | {
"file_path": "pytorch-image-models/timm/layers/bottleneck_attn.py",
"repo_id": "pytorch-image-models",
"token_count": 2907
} | 177 |
""" Filter Response Norm in PyTorch
Based on `Filter Response Normalization Layer` - https://arxiv.org/abs/1911.09737
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
import torch.nn as nn
from .create_act import create_act_layer
from .trace_utils import _assert
def inv_instance_rms(x, eps: float... | pytorch-image-models/timm/layers/filter_response_norm.py/0 | {
"file_path": "pytorch-image-models/timm/layers/filter_response_norm.py",
"repo_id": "pytorch-image-models",
"token_count": 1182
} | 178 |
""" Bilinear-Attention-Transform and Non-Local Attention
Paper: `Non-Local Neural Networks With Grouped Bilinear Attentional Transforms`
- https://openaccess.thecvf.com/content_CVPR_2020/html/Chi_Non-Local_Neural_Networks_With_Grouped_Bilinear_Attentional_Transforms_CVPR_2020_paper.html
Adapted from original code:... | pytorch-image-models/timm/layers/non_local_attn.py/0 | {
"file_path": "pytorch-image-models/timm/layers/non_local_attn.py",
"repo_id": "pytorch-image-models",
"token_count": 3028
} | 179 |
""" Convolution with Weight Standardization (StdConv and ScaledStdConv)
StdConv:
@article{weightstandardization,
author = {Siyuan Qiao and Huiyu Wang and Chenxi Liu and Wei Shen and Alan Yuille},
title = {Weight Standardization},
journal = {arXiv preprint arXiv:1903.10520},
year = {2019},
}
Code:... | pytorch-image-models/timm/layers/std_conv.py/0 | {
"file_path": "pytorch-image-models/timm/layers/std_conv.py",
"repo_id": "pytorch-image-models",
"token_count": 2483
} | 180 |
""" PyTorch FX Based Feature Extraction Helpers
Using https://pytorch.org/vision/stable/feature_extraction.html
"""
from typing import Callable, List, Dict, Union, Type
import torch
from torch import nn
from ._features import _get_feature_info, _get_return_layers
try:
from torchvision.models.feature_extraction i... | pytorch-image-models/timm/models/_features_fx.py/0 | {
"file_path": "pytorch-image-models/timm/models/_features_fx.py",
"repo_id": "pytorch-image-models",
"token_count": 1801
} | 181 |
"""
CoaT architecture.
Paper: Co-Scale Conv-Attentional Image Transformers - https://arxiv.org/abs/2104.06399
Official CoaT code at: https://github.com/mlpc-ucsd/CoaT
Modified from timm/models/vision_transformer.py
"""
from functools import partial
from typing import Tuple, List, Union
import torch
import torch.nn... | pytorch-image-models/timm/models/coat.py/0 | {
"file_path": "pytorch-image-models/timm/models/coat.py",
"repo_id": "pytorch-image-models",
"token_count": 15685
} | 182 |
""" EfficientViT (by MSRA)
Paper: `EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention`
- https://arxiv.org/abs/2305.07027
Adapted from official impl at https://github.com/microsoft/Cream/tree/main/EfficientViT
"""
__all__ = ['EfficientVitMsra']
import itertools
from collections impor... | pytorch-image-models/timm/models/efficientvit_msra.py/0 | {
"file_path": "pytorch-image-models/timm/models/efficientvit_msra.py",
"repo_id": "pytorch-image-models",
"token_count": 11871
} | 183 |
""" Pytorch Inception-V4 implementation
Sourced from https://github.com/Cadene/tensorflow-model-zoo.torch (MIT License) which is
based upon Google's Tensorflow implementation and pretrained weights (Apache 2.0 License)
"""
from functools import partial
import torch
import torch.nn as nn
from timm.data import IMAGENET... | pytorch-image-models/timm/models/inception_v4.py/0 | {
"file_path": "pytorch-image-models/timm/models/inception_v4.py",
"repo_id": "pytorch-image-models",
"token_count": 5528
} | 184 |
"""RegNet X, Y, Z, and more
Paper: `Designing Network Design Spaces` - https://arxiv.org/abs/2003.13678
Original Impl: https://github.com/facebookresearch/pycls/blob/master/pycls/models/regnet.py
Paper: `Fast and Accurate Model Scaling` - https://arxiv.org/abs/2103.06877
Original Impl: None
Based on original PyTorch... | pytorch-image-models/timm/models/regnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/regnet.py",
"repo_id": "pytorch-image-models",
"token_count": 21400
} | 185 |
""" Transformer in Transformer (TNT) in PyTorch
A PyTorch implement of TNT as described in
'Transformer in Transformer' - https://arxiv.org/abs/2103.00112
The official mindspore code is released and available at
https://gitee.com/mindspore/mindspore/tree/master/model_zoo/research/cv/TNT
"""
import math
import torch
... | pytorch-image-models/timm/models/tnt.py/0 | {
"file_path": "pytorch-image-models/timm/models/tnt.py",
"repo_id": "pytorch-image-models",
"token_count": 6715
} | 186 |
""" Adafactor Optimizer
Lifted from https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py
Original header/copyright below.
"""
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source... | pytorch-image-models/timm/optim/adafactor.py/0 | {
"file_path": "pytorch-image-models/timm/optim/adafactor.py",
"repo_id": "pytorch-image-models",
"token_count": 3656
} | 187 |
"""
SGDP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/sgdp.py
Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217
Code: https://github.com/clovaai/AdamP
Copyright (c) 2020-present NAVER Corp.
MIT license
"""
import ... | pytorch-image-models/timm/optim/sgdp.py/0 | {
"file_path": "pytorch-image-models/timm/optim/sgdp.py",
"repo_id": "pytorch-image-models",
"token_count": 1186
} | 188 |
""" Batch size decay and retry helpers.
Copyright 2022 Ross Wightman
"""
import math
def decay_batch_step(batch_size, num_intra_steps=2, no_odd=False):
""" power of two batch-size decay with intra steps
Decay by stepping between powers of 2:
* determine power-of-2 floor of current batch size (base batch... | pytorch-image-models/timm/utils/decay_batch.py/0 | {
"file_path": "pytorch-image-models/timm/utils/decay_batch.py",
"repo_id": "pytorch-image-models",
"token_count": 656
} | 189 |
[package]
name = "text-generation-benchmark"
description = "Text Generation Benchmarking tool"
version.workspace = true
edition.workspace = true
authors.workspace = true
homepage.workspace = true
[lib]
path = "src/lib.rs"
[[bin]]
name = "text-generation-benchmark"
path = "src/main.rs"
[dependencies]
average = "0.14"... | text-generation-inference/benchmark/Cargo.toml/0 | {
"file_path": "text-generation-inference/benchmark/Cargo.toml",
"repo_id": "text-generation-inference",
"token_count": 381
} | 190 |
from text_generation.errors import (
parse_error,
GenerationError,
IncompleteGenerationError,
OverloadedError,
ValidationError,
BadRequestError,
ShardNotReadyError,
ShardTimeoutError,
NotFoundError,
RateLimitExceededError,
UnknownError,
)
def test_generation_error():
pa... | text-generation-inference/clients/python/tests/test_errors.py/0 | {
"file_path": "text-generation-inference/clients/python/tests/test_errors.py",
"repo_id": "text-generation-inference",
"token_count": 598
} | 191 |
# Using TGI CLI
You can use TGI command-line interface (CLI) to download weights, serve and quantize models, or get information on serving parameters. To install the CLI, please refer to [the installation section](../installation#install-cli).
`text-generation-server` lets you download the model with `download-weight... | text-generation-inference/docs/source/basic_tutorials/using_cli.md/0 | {
"file_path": "text-generation-inference/docs/source/basic_tutorials/using_cli.md",
"repo_id": "text-generation-inference",
"token_count": 329
} | 192 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.