Unverified Commit d2940c23 authored by Kashif Rasul's avatar Kashif Rasul Committed by GitHub
Browse files

Merge branch 'main' into latex

parents 13f003c9 ebbba62c
...@@ -46,7 +46,7 @@ The class provides functionality to compute previous image according to alpha, b ...@@ -46,7 +46,7 @@ The class provides functionality to compute previous image according to alpha, b
## Philosophy ## Philosophy
- Readability and clarity is prefered over highly optimized code. A strong importance is put on providing readable, intuitive and elementary code desgin. *E.g.*, the provided [schedulers](https://github.com/huggingface/diffusers/tree/main/src/diffusers/schedulers) are separated from the provided [models](https://github.com/huggingface/diffusers/tree/main/src/diffusers/models) and provide well-commented code that can be read alongside the original paper. - Readability and clarity is prefered over highly optimized code. A strong importance is put on providing readable, intuitive and elementary code design. *E.g.*, the provided [schedulers](https://github.com/huggingface/diffusers/tree/main/src/diffusers/schedulers) are separated from the provided [models](https://github.com/huggingface/diffusers/tree/main/src/diffusers/models) and provide well-commented code that can be read alongside the original paper.
- Diffusers is **modality independent** and focusses on providing pretrained models and tools to build systems that generate **continous outputs**, *e.g.* vision and audio. - Diffusers is **modality independent** and focusses on providing pretrained models and tools to build systems that generate **continous outputs**, *e.g.* vision and audio.
- Diffusion models and schedulers are provided as consise, elementary building blocks whereas diffusion pipelines are a collection of end-to-end diffusion systems that can be used out-of-the-box, should stay as close as possible to their original implementation and can include components of other library, such as text-encoders. Examples for diffusion pipelines are [Glide](https://github.com/openai/glide-text2im) and [Latent Diffusion](https://github.com/CompVis/latent-diffusion). - Diffusion models and schedulers are provided as consise, elementary building blocks whereas diffusion pipelines are a collection of end-to-end diffusion systems that can be used out-of-the-box, should stay as close as possible to their original implementation and can include components of other library, such as text-encoders. Examples for diffusion pipelines are [Glide](https://github.com/openai/glide-text2im) and [Latent Diffusion](https://github.com/CompVis/latent-diffusion).
...@@ -173,7 +173,7 @@ image_pil = PIL.Image.fromarray(image_processed[0]) ...@@ -173,7 +173,7 @@ image_pil = PIL.Image.fromarray(image_processed[0])
image_pil.save("test.png") image_pil.save("test.png")
``` ```
### 2. `diffusers` as a collection of popula Diffusion systems (GLIDE, Dalle, ...) ### 2. `diffusers` as a collection of popular Diffusion systems (GLIDE, Dalle, ...)
For more examples see [pipelines](https://github.com/huggingface/diffusers/tree/main/src/diffusers/pipelines). For more examples see [pipelines](https://github.com/huggingface/diffusers/tree/main/src/diffusers/pipelines).
...@@ -276,6 +276,7 @@ wavwrite("generated_audio.wav", sampling_rate, audio.squeeze().cpu().numpy()) ...@@ -276,6 +276,7 @@ wavwrite("generated_audio.wav", sampling_rate, audio.squeeze().cpu().numpy())
- Write google colab for training [ ] - Write google colab for training [ ]
- Write docs / Think about how to structure docs [ ] - Write docs / Think about how to structure docs [ ]
- Add tests to circle ci [ ] - Add tests to circle ci [ ]
- Add [Diffusion LM models](https://arxiv.org/pdf/2205.14217.pdf) [ ]
- Add more vision models [ ] - Add more vision models [ ]
- Add more speech models [ ] - Add more speech models [ ]
- Add RL model [ ] - Add RL model [ ]
...@@ -34,7 +34,7 @@ python -m torch.distributed.launch \ ...@@ -34,7 +34,7 @@ python -m torch.distributed.launch \
train_ddpm.py \ train_ddpm.py \
--dataset="huggan/pokemon" \ --dataset="huggan/pokemon" \
--resolution=64 \ --resolution=64 \
--output_path="flowers-ddpm" \ --output_path="pokemon-ddpm" \
--batch_size=16 \ --batch_size=16 \
--num_epochs=100 \ --num_epochs=100 \
--gradient_accumulation_steps=1 \ --gradient_accumulation_steps=1 \
......
...@@ -49,16 +49,16 @@ _tqdm_active = True ...@@ -49,16 +49,16 @@ _tqdm_active = True
def _get_default_logging_level(): def _get_default_logging_level():
""" """
If TRANSFORMERS_VERBOSITY env var is set to one of the valid choices return that as the new default level. If it is If DIFFUSERS_VERBOSITY env var is set to one of the valid choices return that as the new default level. If it is
not - fall back to `_default_log_level` not - fall back to `_default_log_level`
""" """
env_level_str = os.getenv("TRANSFORMERS_VERBOSITY", None) env_level_str = os.getenv("DIFFUSERS_VERBOSITY", None)
if env_level_str: if env_level_str:
if env_level_str in log_levels: if env_level_str in log_levels:
return log_levels[env_level_str] return log_levels[env_level_str]
else: else:
logging.getLogger().warning( logging.getLogger().warning(
f"Unknown option TRANSFORMERS_VERBOSITY={env_level_str}, " f"Unknown option DIFFUSERS_VERBOSITY={env_level_str}, "
f"has to be one of: { ', '.join(log_levels.keys()) }" f"has to be one of: { ', '.join(log_levels.keys()) }"
) )
return _default_log_level return _default_log_level
...@@ -126,14 +126,14 @@ def get_logger(name: Optional[str] = None) -> logging.Logger: ...@@ -126,14 +126,14 @@ def get_logger(name: Optional[str] = None) -> logging.Logger:
def get_verbosity() -> int: def get_verbosity() -> int:
""" """
Return the current level for the 🤗 Transformers's root logger as an int. Return the current level for the 🤗 Diffusers' root logger as an int.
Returns: Returns:
`int`: The logging level. `int`: The logging level.
<Tip> <Tip>
🤗 Transformers has following logging levels: 🤗 Diffusers has following logging levels:
- 50: `diffusers.logging.CRITICAL` or `diffusers.logging.FATAL` - 50: `diffusers.logging.CRITICAL` or `diffusers.logging.FATAL`
- 40: `diffusers.logging.ERROR` - 40: `diffusers.logging.ERROR`
...@@ -149,7 +149,7 @@ def get_verbosity() -> int: ...@@ -149,7 +149,7 @@ def get_verbosity() -> int:
def set_verbosity(verbosity: int) -> None: def set_verbosity(verbosity: int) -> None:
""" """
Set the verbosity level for the 🤗 Transformers's root logger. Set the verbosity level for the 🤗 Diffusers' root logger.
Args: Args:
verbosity (`int`): verbosity (`int`):
...@@ -187,7 +187,7 @@ def set_verbosity_error(): ...@@ -187,7 +187,7 @@ def set_verbosity_error():
def disable_default_handler() -> None: def disable_default_handler() -> None:
"""Disable the default handler of the HuggingFace Transformers's root logger.""" """Disable the default handler of the HuggingFace Diffusers' root logger."""
_configure_library_root_logger() _configure_library_root_logger()
...@@ -196,7 +196,7 @@ def disable_default_handler() -> None: ...@@ -196,7 +196,7 @@ def disable_default_handler() -> None:
def enable_default_handler() -> None: def enable_default_handler() -> None:
"""Enable the default handler of the HuggingFace Transformers's root logger.""" """Enable the default handler of the HuggingFace Diffusers' root logger."""
_configure_library_root_logger() _configure_library_root_logger()
...@@ -205,7 +205,7 @@ def enable_default_handler() -> None: ...@@ -205,7 +205,7 @@ def enable_default_handler() -> None:
def add_handler(handler: logging.Handler) -> None: def add_handler(handler: logging.Handler) -> None:
"""adds a handler to the HuggingFace Transformers's root logger.""" """adds a handler to the HuggingFace Diffusers' root logger."""
_configure_library_root_logger() _configure_library_root_logger()
...@@ -214,7 +214,7 @@ def add_handler(handler: logging.Handler) -> None: ...@@ -214,7 +214,7 @@ def add_handler(handler: logging.Handler) -> None:
def remove_handler(handler: logging.Handler) -> None: def remove_handler(handler: logging.Handler) -> None:
"""removes given handler from the HuggingFace Transformers's root logger.""" """removes given handler from the HuggingFace Diffusers' root logger."""
_configure_library_root_logger() _configure_library_root_logger()
...@@ -233,7 +233,7 @@ def disable_propagation() -> None: ...@@ -233,7 +233,7 @@ def disable_propagation() -> None:
def enable_propagation() -> None: def enable_propagation() -> None:
""" """
Enable propagation of the library log outputs. Please disable the HuggingFace Transformers's default handler to Enable propagation of the library log outputs. Please disable the HuggingFace Diffusers' default handler to
prevent double logging if the root logger has been configured. prevent double logging if the root logger has been configured.
""" """
...@@ -243,7 +243,7 @@ def enable_propagation() -> None: ...@@ -243,7 +243,7 @@ def enable_propagation() -> None:
def enable_explicit_format() -> None: def enable_explicit_format() -> None:
""" """
Enable explicit formatting for every HuggingFace Transformers's logger. The explicit formatter is as follows: Enable explicit formatting for every HuggingFace Diffusers' logger. The explicit formatter is as follows:
``` ```
[LEVELNAME|FILENAME|LINE NUMBER] TIME >> MESSAGE [LEVELNAME|FILENAME|LINE NUMBER] TIME >> MESSAGE
``` ```
...@@ -258,7 +258,7 @@ def enable_explicit_format() -> None: ...@@ -258,7 +258,7 @@ def enable_explicit_format() -> None:
def reset_format() -> None: def reset_format() -> None:
""" """
Resets the formatting for HuggingFace Transformers's loggers. Resets the formatting for HuggingFace Diffusers' loggers.
All handlers currently bound to the root logger are affected by this method. All handlers currently bound to the root logger are affected by this method.
""" """
...@@ -270,10 +270,10 @@ def reset_format() -> None: ...@@ -270,10 +270,10 @@ def reset_format() -> None:
def warning_advice(self, *args, **kwargs): def warning_advice(self, *args, **kwargs):
""" """
This method is identical to `logger.warninging()`, but if env var TRANSFORMERS_NO_ADVISORY_WARNINGS=1 is set, this This method is identical to `logger.warninging()`, but if env var DIFFUSERS_NO_ADVISORY_WARNINGS=1 is set, this
warning will not be printed warning will not be printed
""" """
no_advisory_warnings = os.getenv("TRANSFORMERS_NO_ADVISORY_WARNINGS", False) no_advisory_warnings = os.getenv("DIFFUSERS_NO_ADVISORY_WARNINGS", False)
if no_advisory_warnings: if no_advisory_warnings:
return return
self.warning(*args, **kwargs) self.warning(*args, **kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment