Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/maxdiffusion/configuration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
from dataclasses import asdict, is_dataclass

from huggingface_hub import create_repo, hf_hub_download
from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, RevisionNotFoundError

try:
from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, RevisionNotFoundError
except ImportError:
from huggingface_hub.v0.errors import EntryNotFoundError, RepositoryNotFoundError, RevisionNotFoundError
from requests import HTTPError
import jax.numpy as jnp
from . import __version__
Expand Down
6 changes: 5 additions & 1 deletion src/maxdiffusion/loaders/flux_lora_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
import jax.numpy as jnp
from flax.traverse_util import flatten_dict
from ..models.modeling_flax_pytorch_utils import convert_flux_lora_pytorch_state_dict_to_flax
from huggingface_hub.utils import validate_hf_hub_args

try:
from huggingface_hub.utils import validate_hf_hub_args
except ImportError:
from huggingface_hub.v0.utils import validate_hf_hub_args


class FluxLoraLoaderMixin(LoRABaseMixin):
Expand Down
6 changes: 5 additions & 1 deletion src/maxdiffusion/loaders/lora_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
_maybe_map_sgm_blocks_to_diffusers,
)
from ..models.modeling_flax_pytorch_utils import convert_lora_pytorch_state_dict_to_flax
from huggingface_hub.utils import validate_hf_hub_args

try:
from huggingface_hub.utils import validate_hf_hub_args
except ImportError:
from huggingface_hub.v0.utils import validate_hf_hub_args

TEXT_ENCODER_NAME = "text_encoder"
UNET_NAME = "unet"
Expand Down
6 changes: 5 additions & 1 deletion src/maxdiffusion/models/ltx2/latent_upsampler_ltx2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
from flax import nnx

from huggingface_hub import hf_hub_download
from huggingface_hub.utils import EntryNotFoundError, HfHubHTTPError

try:
from huggingface_hub.utils import EntryNotFoundError, HfHubHTTPError
except ImportError:
from huggingface_hub.v0.utils import EntryNotFoundError, HfHubHTTPError

RATIONAL_RESAMPLER_SCALE_MAPPING = {
0.75: (3, 4),
Expand Down
7 changes: 6 additions & 1 deletion src/maxdiffusion/models/ltx2/ltx2_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
import jax.numpy as jnp
from maxdiffusion import max_logging
from huggingface_hub import hf_hub_download
from huggingface_hub.utils import EntryNotFoundError

try:
from huggingface_hub.utils import EntryNotFoundError
except ImportError:
from huggingface_hub.v0.utils import EntryNotFoundError

from safetensors import safe_open
from flax.traverse_util import unflatten_dict, flatten_dict
from ..modeling_flax_pytorch_utils import (rename_key, rename_key_and_reshape_tensor, torch2jax, validate_flax_state_dict)
Expand Down
6 changes: 5 additions & 1 deletion src/maxdiffusion/models/modeling_flax_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
from flax.serialization import from_bytes, to_bytes
from flax.traverse_util import flatten_dict, unflatten_dict
from huggingface_hub import create_repo, hf_hub_download
from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, RevisionNotFoundError

try:
from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, RevisionNotFoundError
except ImportError:
from huggingface_hub.v0.utils import EntryNotFoundError, RepositoryNotFoundError, RevisionNotFoundError
from requests import HTTPError

from .. import __version__, is_torch_available
Expand Down
6 changes: 5 additions & 1 deletion src/maxdiffusion/trainers/dreambooth_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
import optax
import torch
from torch.utils.data import Dataset
from huggingface_hub.utils import insecure_hashlib

try:
from huggingface_hub.utils import insecure_hashlib
except ImportError:
from huggingface_hub.v0.utils import insecure_hashlib
from tqdm import tqdm

from maxdiffusion.trainers.base_stable_diffusion_trainer import BaseStableDiffusionTrainer
Expand Down
21 changes: 15 additions & 6 deletions src/maxdiffusion/utils/hub_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,21 @@

from huggingface_hub import ModelCard, ModelCardData, create_repo, get_token, hf_hub_download, upload_folder, whoami
from huggingface_hub.file_download import REGEX_COMMIT_HASH
from huggingface_hub.utils import (
EntryNotFoundError,
RepositoryNotFoundError,
RevisionNotFoundError,
is_jinja_available,
)

try:
from huggingface_hub.utils import (
EntryNotFoundError,
RepositoryNotFoundError,
RevisionNotFoundError,
is_jinja_available,
)
except ImportError:
from huggingface_hub.v0.utils import (
EntryNotFoundError,
RepositoryNotFoundError,
RevisionNotFoundError,
is_jinja_available,
)
from packaging import version
from requests import HTTPError

Expand Down
5 changes: 4 additions & 1 deletion src/maxdiffusion/utils/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
from types import ModuleType
from typing import Any, Union

from huggingface_hub.utils import is_jinja_available # noqa: F401
try:
from huggingface_hub.utils import is_jinja_available # noqa: F401
except ImportError:
from huggingface_hub.v0.utils import is_jinja_available # noqa: F401
from packaging import version
from packaging.version import Version, parse

Expand Down
Loading