prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Improve the precision of our integration tests
  We currently have a rather low precision when testing our pipeline due to due reasons. 
  1. - Our reference is an image and not a numpy array. This means that when we created our reference image we lost float precision which is unnecessary
  2. - We only test for `.max() < 1e-2` . IMO we should test for `.max() < 1e-4` with the numpy arrays. In my experiements across multiple devices I have **not** seen differences bigger than `.max() < 1e-4` when using full precision.
  
  IMO this could have also prevented: https://github.com/huggingface/diffusers/issues/902
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/diffusers/utils/__init__.py`
  Content:
  ```
  1 # Copyright 2022 The HuggingFace Inc. team. All rights reserved.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 
  16 import os
  17 
  18 from .deprecation_utils import deprecate
  19 from .import_utils import (
  20     ENV_VARS_TRUE_AND_AUTO_VALUES,
  21     ENV_VARS_TRUE_VALUES,
  22     USE_JAX,
  23     USE_TF,
  24     USE_TORCH,
  25     DummyObject,
  26     is_accelerate_available,
  27     is_flax_available,
  28     is_inflect_available,
  29     is_modelcards_available,
  30     is_onnx_available,
  31     is_scipy_available,
  32     is_tf_available,
  33     is_torch_available,
  34     is_transformers_available,
  35     is_unidecode_available,
  36     requires_backends,
  37 )
  38 from .logging import get_logger
  39 from .outputs import BaseOutput
  40 
  41 
  42 if is_torch_available():
  43     from .testing_utils import (
  44         floats_tensor,
  45         load_image,
  46         load_numpy,
  47         parse_flag_from_env,
  48         require_torch_gpu,
  49         slow,
  50         torch_all_close,
  51         torch_device,
  52     )
  53 
  54 
  55 logger = get_logger(__name__)
  56 
  57 
  58 hf_cache_home = os.path.expanduser(
  59     os.getenv("HF_HOME", os.path.join(os.getenv("XDG_CACHE_HOME", "~/.cache"), "huggingface"))
  60 )
  61 default_cache_path = os.path.join(hf_cache_home, "diffusers")
  62 
  63 
  64 CONFIG_NAME = "config.json"
  65 WEIGHTS_NAME = "diffusion_pytorch_model.bin"
  66 FLAX_WEIGHTS_NAME = "diffusion_flax_model.msgpack"
  67 ONNX_WEIGHTS_NAME = "model.onnx"
  68 HUGGINGFACE_CO_RESOLVE_ENDPOINT = "https://huggingface.co"
  69 DIFFUSERS_CACHE = default_cache_path
  70 DIFFUSERS_DYNAMIC_MODULE_NAME = "diffusers_modules"
  71 HF_MODULES_CACHE = os.getenv("HF_MODULES_CACHE", os.path.join(hf_cache_home, "modules"))
  72
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/diffusers/utils/__init__.py b/src/diffusers/utils/__init__.py
  --- a/src/diffusers/utils/__init__.py
  +++ b/src/diffusers/utils/__init__.py
  @@ -42,6 +42,7 @@
   if is_torch_available():
       from .testing_utils import (
           floats_tensor,
  +        load_hf_numpy,
           load_image,
           load_numpy,
           parse_flag_from_env,
  
verification_info: {"golden_diff": "diff --git a/src/diffusers/utils/__init__.py b/src/diffusers/utils/__init__.py\n--- a/src/diffusers/utils/__init__.py\n+++ b/src/diffusers/utils/__init__.py\n@@ -42,6 +42,7 @@\n if is_torch_available():\n     from .testing_utils import (\n         floats_tensor,\n+        load_hf_numpy,\n         load_image,\n         load_numpy,\n         parse_flag_from_env,\n", "issue": "Improve the precision of our integration tests\nWe currently have a rather low precision when testing our pipeline due to due reasons. \r\n1. - Our reference is an image and not a numpy array. This means that when we created our reference image we lost float precision which is unnecessary\r\n2. - We only test for `.max() < 1e-2` . IMO we should test for `.max() < 1e-4` with the numpy arrays. In my experiements across multiple devices I have **not** seen differences bigger than `.max() < 1e-4` when using full precision.\r\n\r\nIMO this could have also prevented: https://github.com/huggingface/diffusers/issues/902\n", "before_files": [{"content": "# Copyright 2022 The HuggingFace Inc. team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\nimport os\n\nfrom .deprecation_utils import deprecate\nfrom .import_utils import (\n    ENV_VARS_TRUE_AND_AUTO_VALUES,\n    ENV_VARS_TRUE_VALUES,\n    USE_JAX,\n    USE_TF,\n    USE_TORCH,\n    DummyObject,\n    is_accelerate_available,\n    is_flax_available,\n    is_inflect_available,\n    is_modelcards_available,\n    is_onnx_available,\n    is_scipy_available,\n    is_tf_available,\n    is_torch_available,\n    is_transformers_available,\n    is_unidecode_available,\n    requires_backends,\n)\nfrom .logging import get_logger\nfrom .outputs import BaseOutput\n\n\nif is_torch_available():\n    from .testing_utils import (\n        floats_tensor,\n        load_image,\n        load_numpy,\n        parse_flag_from_env,\n        require_torch_gpu,\n        slow,\n        torch_all_close,\n        torch_device,\n    )\n\n\nlogger = get_logger(__name__)\n\n\nhf_cache_home = os.path.expanduser(\n    os.getenv(\"HF_HOME\", os.path.join(os.getenv(\"XDG_CACHE_HOME\", \"~/.cache\"), \"huggingface\"))\n)\ndefault_cache_path = os.path.join(hf_cache_home, \"diffusers\")\n\n\nCONFIG_NAME = \"config.json\"\nWEIGHTS_NAME = \"diffusion_pytorch_model.bin\"\nFLAX_WEIGHTS_NAME = \"diffusion_flax_model.msgpack\"\nONNX_WEIGHTS_NAME = \"model.onnx\"\nHUGGINGFACE_CO_RESOLVE_ENDPOINT = \"https://huggingface.co\"\nDIFFUSERS_CACHE = default_cache_path\nDIFFUSERS_DYNAMIC_MODULE_NAME = \"diffusers_modules\"\nHF_MODULES_CACHE = os.getenv(\"HF_MODULES_CACHE\", os.path.join(hf_cache_home, \"modules\"))\n", "path": "src/diffusers/utils/__init__.py"}], "after_files": [{"content": "# Copyright 2022 The HuggingFace Inc. team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\nimport os\n\nfrom .deprecation_utils import deprecate\nfrom .import_utils import (\n    ENV_VARS_TRUE_AND_AUTO_VALUES,\n    ENV_VARS_TRUE_VALUES,\n    USE_JAX,\n    USE_TF,\n    USE_TORCH,\n    DummyObject,\n    is_accelerate_available,\n    is_flax_available,\n    is_inflect_available,\n    is_modelcards_available,\n    is_onnx_available,\n    is_scipy_available,\n    is_tf_available,\n    is_torch_available,\n    is_transformers_available,\n    is_unidecode_available,\n    requires_backends,\n)\nfrom .logging import get_logger\nfrom .outputs import BaseOutput\n\n\nif is_torch_available():\n    from .testing_utils import (\n        floats_tensor,\n        load_hf_numpy,\n        load_image,\n        load_numpy,\n        parse_flag_from_env,\n        require_torch_gpu,\n        slow,\n        torch_all_close,\n        torch_device,\n    )\n\n\nlogger = get_logger(__name__)\n\n\nhf_cache_home = os.path.expanduser(\n    os.getenv(\"HF_HOME\", os.path.join(os.getenv(\"XDG_CACHE_HOME\", \"~/.cache\"), \"huggingface\"))\n)\ndefault_cache_path = os.path.join(hf_cache_home, \"diffusers\")\n\n\nCONFIG_NAME = \"config.json\"\nWEIGHTS_NAME = \"diffusion_pytorch_model.bin\"\nFLAX_WEIGHTS_NAME = \"diffusion_flax_model.msgpack\"\nONNX_WEIGHTS_NAME = \"model.onnx\"\nHUGGINGFACE_CO_RESOLVE_ENDPOINT = \"https://huggingface.co\"\nDIFFUSERS_CACHE = default_cache_path\nDIFFUSERS_DYNAMIC_MODULE_NAME = \"diffusers_modules\"\nHF_MODULES_CACHE = os.getenv(\"HF_MODULES_CACHE\", os.path.join(hf_cache_home, \"modules\"))\n", "path": "src/diffusers/utils/__init__.py"}]}