Skip to content

fix(backend): replace bare except with Exception in device check#821

Merged
alvarobartt merged 1 commit intohuggingface:mainfrom
llukito:fix/device-check-bare-except
Mar 11, 2026
Merged

fix(backend): replace bare except with Exception in device check#821
alvarobartt merged 1 commit intohuggingface:mainfrom
llukito:fix/device-check-bare-except

Conversation

@llukito
Copy link
Copy Markdown
Contributor

@llukito llukito commented Feb 11, 2026

Description

This PR replaces a bare except: clause with except Exception: in backends/python/server/text_embeddings_server/utils/device.py.

The previous implementation caught BaseException, which includes SystemExit and KeyboardInterrupt. Since this block wraps a subprocess.run call, a bare except could prevent a user from interrupting the process (Ctrl+C) if the external hl-smi command hangs or takes too long.

Verification

  • Verified via code inspection.
  • This ensures standard runtime errors are caught while allowing system control signals to propagate.

Replaces a bare `except:` with `except Exception:` in `is_hpu()`.

The previous bare except caught `BaseException`, which includes `SystemExit` and `KeyboardInterrupt`. Since this wraps a `subprocess.run` call, it could prevent a user from interrupting the process if the external `hl-smi` command hangs.
@llukito
Copy link
Copy Markdown
Contributor Author

llukito commented Feb 18, 2026

Hi, just checking in on this, it’s ready for review whenever someone has a moment. Thanks!

@alvarobartt
Copy link
Copy Markdown
Member

Thanks for reporting @llukito, let me ping @regisss from our side as this is Intel-related 🤗

Copy link
Copy Markdown
Collaborator

@regisss regisss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@alvarobartt alvarobartt merged commit f016879 into huggingface:main Mar 11, 2026
2 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants