Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3a368f2
chore: Update is_google_colab check to use environment variable
tolgacangoz Jun 3, 2024
9da384e
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jun 5, 2024
727e93c
Merge branch 'main' into fix-envinfo-notebook
sayakpaul Jun 6, 2024
dd71787
Check Colab with all possible COLAB_* env variables
tolgacangoz Jun 7, 2024
82ef0cc
Remove unnecessary word
tolgacangoz Jun 7, 2024
93ff882
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jun 7, 2024
6406db2
Make `_is_google_colab` more inclusive
tolgacangoz Jun 7, 2024
c1d57b4
Revert "Make `_is_google_colab` more inclusive"
tolgacangoz Jun 7, 2024
aae08af
Merge branch 'fix-envinfo-notebook' of github.com:tolgacangoz/diffuse…
tolgacangoz Jun 7, 2024
7e102a0
Make `_is_google_colab` more inclusive.
tolgacangoz Jun 7, 2024
a0ce57c
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jun 17, 2024
6d0cdca
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jun 18, 2024
d778c54
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jun 19, 2024
ff3a4d7
chore: Update import_utils.py with notebook check improvement
tolgacangoz Jun 19, 2024
63d99e0
Refactor import_utils.py to improve notebook detection for VS Code's …
tolgacangoz Jun 19, 2024
8e3000a
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jun 20, 2024
78ffbf3
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jun 21, 2024
7981d76
chore: Remove `is_notebook()` function and related code
tolgacangoz Jun 21, 2024
942f87b
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jun 24, 2024
cef73a7
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jun 24, 2024
d155384
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jul 8, 2024
e00cc90
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jul 11, 2024
b4ba58d
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jul 13, 2024
5f377c2
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jul 20, 2024
a755f6f
Merge branch 'main' into fix-envinfo-notebook
tolgacangoz Jul 22, 2024
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: 1 addition & 5 deletions src/diffusers/commands/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
is_bitsandbytes_available,
is_flax_available,
is_google_colab,
is_notebook,
is_peft_available,
is_safetensors_available,
is_torch_available,
Expand Down Expand Up @@ -107,8 +106,6 @@ def run(self) -> dict:

platform_info = platform.platform()

is_notebook_str = "Yes" if is_notebook() else "No"

is_google_colab_str = "Yes" if is_google_colab() else "No"

accelerator = "NA"
Expand All @@ -123,7 +120,7 @@ def run(self) -> dict:
out_str = out_str.decode("utf-8")

if len(out_str) > 0:
accelerator = out_str.strip() + " VRAM"
accelerator = out_str.strip()
except FileNotFoundError:
pass
elif platform.system() == "Darwin": # Mac OS
Expand Down Expand Up @@ -155,7 +152,6 @@ def run(self) -> dict:
info = {
"🤗 Diffusers version": version,
"Platform": platform_info,
"Running on a notebook?": is_notebook_str,
"Running on Google Colab?": is_google_colab_str,
"Python version": platform.python_version(),
"PyTorch version (GPU?)": f"{pt_version} ({pt_cuda_available})",
Expand Down
1 change: 0 additions & 1 deletion src/diffusers/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
is_librosa_available,
is_matplotlib_available,
is_note_seq_available,
is_notebook,
is_onnx_available,
is_peft_available,
is_peft_version,
Expand Down
17 changes: 1 addition & 16 deletions src/diffusers/utils/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,7 @@ def is_timm_available():
except importlib_metadata.PackageNotFoundError:
_bitsandbytes_available = False

# Taken from `huggingface_hub`.
_is_notebook = False
try:
shell_class = get_ipython().__class__ # type: ignore # noqa: F821
for parent_class in shell_class.__mro__: # e.g. "is subclass of"
if parent_class.__name__ == "ZMQInteractiveShell":
_is_notebook = True # Jupyter notebook, Google colab or qtconsole
break
except NameError:
pass # Probably standard Python interpreter

_is_google_colab = "google.colab" in sys.modules
_is_google_colab = "google.colab" in sys.modules or any(k.startswith("COLAB_") for k in os.environ)


def is_torch_available():
Expand Down Expand Up @@ -443,10 +432,6 @@ def is_bitsandbytes_available():
return _bitsandbytes_available


def is_notebook():
return _is_notebook


def is_google_colab():
return _is_google_colab

Expand Down