repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/server/server.py
examples/server/server.py
import asyncio import logging import os import random import tempfile import traceback import uuid import aiohttp import torch from fastapi import FastAPI, HTTPException from fastapi.middleware.cors import CORSMiddleware from fastapi.staticfiles import StaticFiles from pydantic import BaseModel from diffusers.pipelin...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/pytorch_xla/training/text_to_image/train_text_to_image_xla.py
examples/research_projects/pytorch_xla/training/text_to_image/train_text_to_image_xla.py
import argparse import os import random import time from pathlib import Path import datasets import numpy as np import torch import torch.nn.functional as F import torch.utils.checkpoint import torch_xla.core.xla_model as xm import torch_xla.debug.profiler as xp import torch_xla.distributed.parallel_loader as pl impor...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/pytorch_xla/inference/flux/flux_inference.py
examples/research_projects/pytorch_xla/inference/flux/flux_inference.py
from argparse import ArgumentParser from pathlib import Path from time import perf_counter import structlog import torch import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met import torch_xla.debug.profiler as xp import torch_xla.distributed.xla_multiprocessing as xmp import torch_xla.runtime as ...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/vae/vae_roundtrip.py
examples/research_projects/vae/vae_roundtrip.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/gligen/train_gligen_text.py
examples/research_projects/gligen/train_gligen_text.py
# from accelerate.utils import write_basic_config # # write_basic_config() import argparse import logging import math import os import shutil from pathlib import Path import accelerate import torch import torch.nn.functional as F import torch.utils.checkpoint import transformers from accelerate import Accelerator from...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/gligen/dataset.py
examples/research_projects/gligen/dataset.py
import os import random import torch import torchvision.transforms as transforms from PIL import Image def recalculate_box_and_verify_if_valid(x, y, w, h, image_size, original_image_size, min_box_size): scale = image_size / min(original_image_size) crop_y = (original_image_size[1] * scale - image_size) // 2 ...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/gligen/make_datasets.py
examples/research_projects/gligen/make_datasets.py
import argparse import os import random import torch import torchvision import torchvision.transforms as TS from PIL import Image from ram import inference_ram from ram.models import ram from tqdm import tqdm from transformers import ( AutoModelForZeroShotObjectDetection, AutoProcessor, Blip2ForConditional...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/ip_adapter/tutorial_train_plus.py
examples/research_projects/ip_adapter/tutorial_train_plus.py
import argparse import itertools import json import os import random import time from pathlib import Path import torch import torch.nn.functional as F from accelerate import Accelerator from accelerate.utils import ProjectConfiguration from ip_adapter.resampler import Resampler from ip_adapter.utils import is_torch2_a...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/ip_adapter/tutorial_train_ip-adapter.py
examples/research_projects/ip_adapter/tutorial_train_ip-adapter.py
import argparse import itertools import json import os import random import time from pathlib import Path import torch import torch.nn.functional as F from accelerate import Accelerator from accelerate.utils import ProjectConfiguration from ip_adapter.ip_adapter import ImageProjModel from ip_adapter.utils import is_to...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/ip_adapter/tutorial_train_sdxl.py
examples/research_projects/ip_adapter/tutorial_train_sdxl.py
import argparse import itertools import json import os import random import time from pathlib import Path import numpy as np import torch import torch.nn.functional as F from accelerate import Accelerator from accelerate.utils import ProjectConfiguration from ip_adapter.ip_adapter import ImageProjModel from ip_adapter...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/ip_adapter/tutorial_train_faceid.py
examples/research_projects/ip_adapter/tutorial_train_faceid.py
import argparse import itertools import json import os import random import time from pathlib import Path import torch import torch.nn.functional as F from accelerate import Accelerator from accelerate.utils import ProjectConfiguration from ip_adapter.attention_processor_faceid import LoRAAttnProcessor, LoRAIPAttnProc...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/scheduled_huber_loss_training/dreambooth/train_dreambooth_lora_sdxl.py
examples/research_projects/scheduled_huber_loss_training/dreambooth/train_dreambooth_lora_sdxl.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/scheduled_huber_loss_training/dreambooth/train_dreambooth_lora.py
examples/research_projects/scheduled_huber_loss_training/dreambooth/train_dreambooth_lora.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/scheduled_huber_loss_training/dreambooth/train_dreambooth.py
examples/research_projects/scheduled_huber_loss_training/dreambooth/train_dreambooth.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/scheduled_huber_loss_training/text_to_image/train_text_to_image.py
examples/research_projects/scheduled_huber_loss_training/text_to_image/train_text_to_image.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/scheduled_huber_loss_training/text_to_image/train_text_to_image_lora.py
examples/research_projects/scheduled_huber_loss_training/text_to_image/train_text_to_image_lora.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/scheduled_huber_loss_training/text_to_image/train_text_to_image_lora_sdxl.py
examples/research_projects/scheduled_huber_loss_training/text_to_image/train_text_to_image_lora_sdxl.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/scheduled_huber_loss_training/text_to_image/train_text_to_image_sdxl.py
examples/research_projects/scheduled_huber_loss_training/text_to_image/train_text_to_image_sdxl.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/anytext/anytext_controlnet.py
examples/research_projects/anytext/anytext_controlnet.py
# 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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/anytext/anytext.py
examples/research_projects/anytext/anytext.py
# Copyright 2025 The HuggingFace Team. All rights reserved. # Copyright (c) Alibaba, Inc. and its affiliates. # # 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/lic...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/anytext/ocr_recog/RecMv1_enhance.py
examples/research_projects/anytext/ocr_recog/RecMv1_enhance.py
import torch import torch.nn as nn import torch.nn.functional as F from .common import Activation class ConvBNLayer(nn.Module): def __init__( self, num_channels, filter_size, num_filters, stride, padding, channels=None, num_groups=1, act="hard_swish" ): super(ConvBNLayer, self).__init__() ...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/anytext/ocr_recog/common.py
examples/research_projects/anytext/ocr_recog/common.py
import torch import torch.nn as nn import torch.nn.functional as F class Hswish(nn.Module): def __init__(self, inplace=True): super(Hswish, self).__init__() self.inplace = inplace def forward(self, x): return x * F.relu6(x + 3.0, inplace=self.inplace) / 6.0 # out = max(0, min(1, slo...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/anytext/ocr_recog/RecSVTR.py
examples/research_projects/anytext/ocr_recog/RecSVTR.py
import numpy as np import torch import torch.nn as nn from torch.nn import functional from torch.nn.init import ones_, trunc_normal_, zeros_ def drop_path(x, drop_prob=0.0, training=False): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). the original name is mislead...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/anytext/ocr_recog/RecModel.py
examples/research_projects/anytext/ocr_recog/RecModel.py
from torch import nn from .RecCTCHead import CTCHead from .RecMv1_enhance import MobileNetV1Enhance from .RNN import Im2Im, Im2Seq, SequenceEncoder backbone_dict = {"MobileNetV1Enhance": MobileNetV1Enhance} neck_dict = {"SequenceEncoder": SequenceEncoder, "Im2Seq": Im2Seq, "None": Im2Im} head_dict = {"CTCHead": CTCH...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/anytext/ocr_recog/RNN.py
examples/research_projects/anytext/ocr_recog/RNN.py
import torch from torch import nn from .RecSVTR import Block class Swish(nn.Module): def __int__(self): super(Swish, self).__int__() def forward(self, x): return x * torch.sigmoid(x) class Im2Im(nn.Module): def __init__(self, in_channels, **kwargs): super().__init__() s...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/anytext/ocr_recog/RecCTCHead.py
examples/research_projects/anytext/ocr_recog/RecCTCHead.py
from torch import nn class CTCHead(nn.Module): def __init__( self, in_channels, out_channels=6625, fc_decay=0.0004, mid_channels=None, return_feats=False, **kwargs ): super(CTCHead, self).__init__() if mid_channels is None: self.fc = nn.Linear( in_channels, ...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/autoencoderkl/train_autoencoderkl.py
examples/research_projects/autoencoderkl/train_autoencoderkl.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/wuerstchen/text_to_image/train_text_to_image_lora_prior.py
examples/research_projects/wuerstchen/text_to_image/train_text_to_image_lora_prior.py
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/wuerstchen/text_to_image/train_text_to_image_prior.py
examples/research_projects/wuerstchen/text_to_image/train_text_to_image_prior.py
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/wuerstchen/text_to_image/modeling_efficient_net_encoder.py
examples/research_projects/wuerstchen/text_to_image/modeling_efficient_net_encoder.py
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,...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/wuerstchen/text_to_image/__init__.py
examples/research_projects/wuerstchen/text_to_image/__init__.py
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/dreambooth_inpaint/train_dreambooth_inpaint.py
examples/research_projects/dreambooth_inpaint/train_dreambooth_inpaint.py
import argparse import itertools import math import os import random from pathlib import Path import numpy as np import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.utils import ProjectConfiguration, set...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/dreambooth_inpaint/train_dreambooth_inpaint_lora.py
examples/research_projects/dreambooth_inpaint/train_dreambooth_inpaint_lora.py
import argparse import math import os import random from pathlib import Path import numpy as np import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.utils import ProjectConfiguration, set_seed from huggin...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/onnxruntime/textual_inversion/textual_inversion.py
examples/research_projects/onnxruntime/textual_inversion/textual_inversion.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/onnxruntime/text_to_image/train_text_to_image.py
examples/research_projects/onnxruntime/text_to_image/train_text_to_image.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/onnxruntime/unconditional_image_generation/train_unconditional.py
examples/research_projects/onnxruntime/unconditional_image_generation/train_unconditional.py
import argparse import inspect import logging import math import os from pathlib import Path import accelerate import datasets import torch import torch.nn.functional as F from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.utils import ProjectConfiguration from datasets import...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/multi_token_textual_inversion/multi_token_clip.py
examples/research_projects/multi_token_textual_inversion/multi_token_clip.py
""" The main idea for this code is to provide a way for users to not need to bother with the hassle of multiple tokens for a concept by typing a photo of <concept>_0 <concept>_1 ... and so on and instead just do a photo of <concept> which gets translated to the above. This needs to work for both inference and training....
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/multi_token_textual_inversion/textual_inversion_flax.py
examples/research_projects/multi_token_textual_inversion/textual_inversion_flax.py
import argparse import logging import math import os import random from pathlib import Path import jax import jax.numpy as jnp import numpy as np import optax import PIL import torch import torch.utils.checkpoint import transformers from flax import jax_utils from flax.training import train_state from flax.training.co...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/multi_token_textual_inversion/textual_inversion.py
examples/research_projects/multi_token_textual_inversion/textual_inversion.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/sd3_lora_colab/train_dreambooth_lora_sd3_miniature.py
examples/research_projects/sd3_lora_colab/train_dreambooth_lora_sd3_miniature.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/sd3_lora_colab/compute_embeddings.py
examples/research_projects/sd3_lora_colab/compute_embeddings.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/multi_subject_dreambooth/train_multi_subject_dreambooth.py
examples/research_projects/multi_subject_dreambooth/train_multi_subject_dreambooth.py
import argparse import itertools import json import logging import math import uuid import warnings from os import environ, listdir, makedirs from os.path import basename, join from pathlib import Path from typing import List import datasets import numpy as np import torch import torch.nn.functional as F import torch....
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/intel_opts/inference_bf16.py
examples/research_projects/intel_opts/inference_bf16.py
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline parser = argparse.ArgumentParser("Stable Diffusion script with intel optimization", add_help=False) parser.add_argument("--dpm", action="store_true", help="Enable DPMSol...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/intel_opts/textual_inversion_dfq/text2images.py
examples/research_projects/intel_opts/textual_inversion_dfq/text2images.py
import argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNet2DConditionModel def parse_args(): parser = argparse.ArgumentParser() ...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/intel_opts/textual_inversion_dfq/textual_inversion.py
examples/research_projects/intel_opts/textual_inversion_dfq/textual_inversion.py
import argparse import itertools import math import os import random from pathlib import Path from typing import Iterable import numpy as np import PIL import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.utils import ProjectConfiguration, set_se...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/intel_opts/textual_inversion/textual_inversion_bf16.py
examples/research_projects/intel_opts/textual_inversion/textual_inversion_bf16.py
import argparse import itertools import math import os import random from pathlib import Path import intel_extension_for_pytorch as ipex import numpy as np import PIL import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.logging import get_logger ...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/multi_subject_dreambooth_inpainting/train_multi_subject_dreambooth_inpainting.py
examples/research_projects/multi_subject_dreambooth_inpainting/train_multi_subject_dreambooth_inpainting.py
import argparse import copy import itertools import logging import math import os import random from pathlib import Path import numpy as np import torch import torch.nn.functional as F import torch.utils.checkpoint from accelerate import Accelerator from accelerate.logging import get_logger from accelerate.utils impor...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/colossalai/inference.py
examples/research_projects/colossalai/inference.py
import torch from diffusers import StableDiffusionPipeline model_id = "path-to-your-trained-model" pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda") prompt = "A photo of sks dog in a bucket" image = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0] imag...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/colossalai/train_dreambooth_colossalai.py
examples/research_projects/colossalai/train_dreambooth_colossalai.py
import argparse import math import os from pathlib import Path import colossalai import torch import torch.nn.functional as F import torch.utils.checkpoint from colossalai.context.parallel_mode import ParallelMode from colossalai.core import global_context as gpc from colossalai.logging import disable_existing_loggers...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/flux_lora_quantization/compute_embeddings.py
examples/research_projects/flux_lora_quantization/compute_embeddings.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/flux_lora_quantization/train_dreambooth_lora_flux_miniature.py
examples/research_projects/flux_lora_quantization/train_dreambooth_lora_flux_miniature.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/controlnet/train_controlnet_webdataset.py
examples/research_projects/controlnet/train_controlnet_webdataset.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/diffusion_orpo/train_diffusion_orpo_sdxl_lora_wds.py
examples/research_projects/diffusion_orpo/train_diffusion_orpo_sdxl_lora_wds.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/diffusion_orpo/train_diffusion_orpo_sdxl_lora.py
examples/research_projects/diffusion_orpo/train_diffusion_orpo_sdxl_lora.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/sana/train_sana_sprint_diffusers.py
examples/research_projects/sana/train_sana_sprint_diffusers.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2025 Sana-Sprint team. All rights reserved. # 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 ...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/consistency_training/train_cm_ct_unconditional.py
examples/research_projects/consistency_training/train_cm_ct_unconditional.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/control_lora/control_lora.py
examples/research_projects/control_lora/control_lora.py
import cv2 import numpy as np import torch from PIL import Image from diffusers import ( AutoencoderKL, ControlNetModel, StableDiffusionXLControlNetPipeline, UNet2DConditionModel, ) from diffusers.utils import load_image, make_image_grid pipe_id = "stabilityai/stable-diffusion-xl-base-1.0" lora_id = ...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/promptdiffusion/pipeline_prompt_diffusion.py
examples/research_projects/promptdiffusion/pipeline_prompt_diffusion.py
# 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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/promptdiffusion/convert_original_promptdiffusion_to_diffusers.py
examples/research_projects/promptdiffusion/convert_original_promptdiffusion_to_diffusers.py
# 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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/promptdiffusion/promptdiffusioncontrolnet.py
examples/research_projects/promptdiffusion/promptdiffusioncontrolnet.py
# 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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/rdm/pipeline_rdm.py
examples/research_projects/rdm/pipeline_rdm.py
import inspect from typing import Callable, List, Optional, Union import torch from PIL import Image from retriever import Retriever, normalize_images, preprocess_images from transformers import CLIPImageProcessor, CLIPModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPip...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/rdm/retriever.py
examples/research_projects/rdm/retriever.py
import os from typing import List import faiss import numpy as np import torch from datasets import Dataset, load_dataset from PIL import Image from transformers import CLIPImageProcessor, CLIPModel, PretrainedConfig from diffusers import logging logger = logging.get_logger(__name__) # pylint: disable=invalid-name...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/realfill/train_realfill.py
examples/research_projects/realfill/train_realfill.py
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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/realfill/infer.py
examples/research_projects/realfill/infer.py
import argparse import os import torch from PIL import Image, ImageFilter from transformers import CLIPTextModel from diffusers import DPMSolverMultistepScheduler, StableDiffusionInpaintPipeline, UNet2DConditionModel parser = argparse.ArgumentParser(description="Inference") parser.add_argument( "--model_path", ...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/pixart/run_pixart_alpha_controlnet_pipeline.py
examples/research_projects/pixart/run_pixart_alpha_controlnet_pipeline.py
import torch import torchvision.transforms as T from controlnet_aux import HEDdetector from diffusers.utils import load_image from examples.research_projects.pixart.controlnet_pixart_alpha import PixArtControlNetAdapterModel from examples.research_projects.pixart.pipeline_pixart_alpha_controlnet import PixArtAlphaCont...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/pixart/train_pixart_controlnet_hf.py
examples/research_projects/pixart/train_pixart_controlnet_hf.py
# 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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/pixart/pipeline_pixart_alpha_controlnet.py
examples/research_projects/pixart/pipeline_pixart_alpha_controlnet.py
# Copyright 2025 PixArt-Alpha 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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/pixart/controlnet_pixart_alpha.py
examples/research_projects/pixart/controlnet_pixart_alpha.py
from typing import Any, Dict, Optional import torch from torch import nn from diffusers.configuration_utils import ConfigMixin, register_to_config from diffusers.models import PixArtTransformer2DModel from diffusers.models.attention import BasicTransformerBlock from diffusers.models.modeling_outputs import Transforme...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/diffusion_dpo/train_diffusion_dpo_sdxl.py
examples/research_projects/diffusion_dpo/train_diffusion_dpo_sdxl.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2025 bram-w, 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/lic...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/diffusion_dpo/train_diffusion_dpo.py
examples/research_projects/diffusion_dpo/train_diffusion_dpo.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2025 bram-w, 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/lic...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/lora/train_text_to_image_lora.py
examples/research_projects/lora/train_text_to_image_lora.py
# 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/LICENSE-2.0 # # Unless r...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/sdxl_flax/sdxl_single_aot.py
examples/research_projects/sdxl_flax/sdxl_single_aot.py
import time import jax import jax.numpy as jnp import numpy as np from flax.jax_utils import replicate from jax import pmap # Let's cache the model compilation, so that it doesn't take as long the next time around. from jax.experimental.compilation_cache import compilation_cache as cc from diffusers import FlaxStabl...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/sdxl_flax/sdxl_single.py
examples/research_projects/sdxl_flax/sdxl_single.py
# Show best practices for SDXL JAX import time import jax import jax.numpy as jnp import numpy as np from flax.jax_utils import replicate # Let's cache the model compilation, so that it doesn't take as long the next time around. from jax.experimental.compilation_cache import compilation_cache as cc from diffusers im...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/research_projects/instructpix2pix_lora/train_instruct_pix2pix_lora.py
examples/research_projects/instructpix2pix_lora/train_instruct_pix2pix_lora.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/unconditional_image_generation/train_unconditional.py
examples/unconditional_image_generation/train_unconditional.py
import argparse import inspect import logging import math import os import shutil from datetime import timedelta from pathlib import Path import accelerate import datasets import torch import torch.nn.functional as F from accelerate import Accelerator, InitProcessGroupKwargs from accelerate.logging import get_logger f...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/unconditional_image_generation/test_unconditional.py
examples/unconditional_image_generation/test_unconditional.py
# coding=utf-8 # Copyright 2025 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/inference/image_to_image.py
examples/inference/image_to_image.py
import warnings from diffusers import StableDiffusionImg2ImgPipeline # noqa F401 warnings.warn( "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionImg2ImgPipeline` instead." )
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/inference/inpainting.py
examples/inference/inpainting.py
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( "The `inpainting.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionInpaintPipeline` instead." )
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/flux-control/train_control_flux.py
examples/flux-control/train_control_flux.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/flux-control/train_control_lora_flux.py
examples/flux-control/train_control_lora_flux.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/consistency_distillation/test_lcm_lora.py
examples/consistency_distillation/test_lcm_lora.py
# coding=utf-8 # Copyright 2025 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/consistency_distillation/train_lcm_distill_lora_sdxl.py
examples/consistency_distillation/train_lcm_distill_lora_sdxl.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2025 The LCM team 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.apach...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/consistency_distillation/train_lcm_distill_sdxl_wds.py
examples/consistency_distillation/train_lcm_distill_sdxl_wds.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/consistency_distillation/train_lcm_distill_lora_sd_wds.py
examples/consistency_distillation/train_lcm_distill_lora_sd_wds.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/consistency_distillation/train_lcm_distill_sd_wds.py
examples/consistency_distillation/train_lcm_distill_sd_wds.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/consistency_distillation/train_lcm_distill_lora_sdxl_wds.py
examples/consistency_distillation/train_lcm_distill_lora_sdxl_wds.py
#!/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...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/reinforcement_learning/run_diffuser_locomotion.py
examples/reinforcement_learning/run_diffuser_locomotion.py
import d4rl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline config = { "n_samples": 64, "horizon": 32, "num_inference_steps": 20, "n_guide_steps": 2, # can set to 0 for faster sampling, does not use value network "scale_grad_by_std": True, "scale": 0.1,...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/reinforcement_learning/diffusion_policy.py
examples/reinforcement_learning/diffusion_policy.py
import numpy as np import numpy.core.multiarray as multiarray import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch.serialization import add_safe_globals from diffusers import DDPMScheduler, UNet1DModel add_safe_globals( [ multiarray._reconstruct, np.ndarray, ...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
false
huggingface/diffusers
https://github.com/huggingface/diffusers/blob/47378066c002573613a1dba686570fbd5a1cf48a/examples/model_search/pipeline_easy.py
examples/model_search/pipeline_easy.py
# coding=utf-8 # Copyright 2025 suzukimain # # 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 t...
python
Apache-2.0
47378066c002573613a1dba686570fbd5a1cf48a
2026-01-04T14:42:56.953111Z
true
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/noxfile.py
noxfile.py
import nox @nox.session(reuse_venv=True, name="test-pydantic-v1") def test_pydantic_v1(session: nox.Session) -> None: session.install("-r", "requirements-dev.lock") session.install("pydantic<2") session.run("pytest", "--showlocals", "--ignore=tests/functional", *session.posargs)
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/scripts/detect-breaking-changes.py
scripts/detect-breaking-changes.py
from __future__ import annotations import sys from typing import Iterator from pathlib import Path import rich import griffe from rich.text import Text from rich.style import Style def public_members(obj: griffe.Object | griffe.Alias) -> dict[str, griffe.Object | griffe.Alias]: if isinstance(obj, griffe.Alias):...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/scripts/utils/ruffen-docs.py
scripts/utils/ruffen-docs.py
# fork of https://github.com/asottile/blacken-docs adapted for ruff from __future__ import annotations import re import sys import argparse import textwrap import contextlib import subprocess from typing import Match, Optional, Sequence, Generator, NamedTuple, cast MD_RE = re.compile( r"(?P<before>^(?P<indent> *)...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/src/openai/_models.py
src/openai/_models.py
from __future__ import annotations import os import inspect import weakref from typing import TYPE_CHECKING, Any, Type, Tuple, Union, Generic, TypeVar, Callable, Optional, cast from datetime import date, datetime from typing_extensions import ( List, Unpack, Literal, ClassVar, Protocol, Require...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
true
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/src/openai/_response.py
src/openai/_response.py
from __future__ import annotations import os import inspect import logging import datetime import functools from types import TracebackType from typing import ( TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, Iterator, AsyncIterator, cast, overload, ) from typing_extensio...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/src/openai/_constants.py
src/openai/_constants.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import httpx RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response" OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" # default timeout is 10 minutes DEFAULT_TIMEOUT = httpx.Timeout(timeout=600, connect=5.0) DEFAULT_MAX_RETRIES ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/src/openai/_exceptions.py
src/openai/_exceptions.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations from typing import TYPE_CHECKING, Any, Optional, cast from typing_extensions import Literal import httpx from ._utils import is_dict from ._models import construct_type if TYPE_CHECKING: fro...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/src/openai/_legacy_response.py
src/openai/_legacy_response.py
from __future__ import annotations import os import inspect import logging import datetime import functools from typing import ( TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, Iterator, AsyncIterator, cast, overload, ) from typing_extensions import Awaitable, ParamSpec, ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/src/openai/_resource.py
src/openai/_resource.py
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations import time from typing import TYPE_CHECKING import anyio if TYPE_CHECKING: from ._client import OpenAI, AsyncOpenAI class SyncAPIResource: _client: OpenAI def __init__(self, clien...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/src/openai/_qs.py
src/openai/_qs.py
from __future__ import annotations from typing import Any, List, Tuple, Union, Mapping, TypeVar from urllib.parse import parse_qs, urlencode from typing_extensions import Literal, get_args from ._types import NotGiven, not_given from ._utils import flatten _T = TypeVar("_T") ArrayFormat = Literal["comma", "repeat"...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/src/openai/_base_client.py
src/openai/_base_client.py
from __future__ import annotations import sys import json import time import uuid import email import asyncio import inspect import logging import platform import email.utils from types import TracebackType from random import random from typing import ( TYPE_CHECKING, Any, Dict, Type, Union, Ge...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
true