environment
- sentence_transformers.util.environment.check_package_availability(package_name: str, owner: str) bool[source]
Checks if a package is available from the correct owner.
- sentence_transformers.util.environment.get_device_name() str[source]
Returns the name of the device where this module is running on.
This function only supports single device or basic distributed training setups. In distributed mode for cuda device, it uses the rank to assign a specific CUDA device.
- Returns:
Device name, like ‘cuda:2’, ‘mps’, ‘npu’, ‘xpu’, ‘hpu’, or ‘cpu’
- Return type:
str
- sentence_transformers.util.environment.is_accelerate_available() bool[source]
Returns True if the Huggingface accelerate library is available.
- sentence_transformers.util.environment.is_datasets_available() bool[source]
Returns True if the Huggingface datasets library is available.