Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# History

1.2.4 (2026-04-24)
------------------
* Support `mps` (MacOS) with `phold autotune`

1.2.4 (2026-04-22)
------------------
* Bugfix to ensure ProstT5 confidence outputs are correctly output when annotating multiple contigs/genomes with `phold run` or `phold predict`
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = ["setuptools>=61.0", "wheel>=0.37.1"]
[project]
# https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
name = "phold"
version = "1.2.4" # change VERSION too
version = "1.2.5" # change VERSION too
description = "Phage Annotations using Protein Structures"
readme = "README.md"
requires-python = ">=3.8, <4"
Expand Down
15 changes: 13 additions & 2 deletions src/phold/features/autotune.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ def sample_probe_sequences(seqs, n=5000, seed=0):

return sampled


def device_synchronize(device: torch.device):
if device.type == "cuda":
torch.cuda.synchronize(device)
elif device.type == "mps":
torch.mps.synchronize()
# CPU and others: no-op

def autotune_batching_real_data(
model_dir,
model_name,
Expand All @@ -67,6 +75,7 @@ def autotune_batching_real_data(

if cpu is True:
device = torch.device("cpu")
logger.error("You are running phold autotune with CPU, which is not supported. Please use --batch_size 1")
else:
# check for NVIDIA/cuda
if torch.cuda.is_available():
Expand All @@ -76,6 +85,7 @@ def autotune_batching_real_data(
device = torch.device("mps")
else:
device = torch.device("cpu")
logger.error("You are running phold autotune with CPU, which is not supported. Please use --batch_size 1")


while bs <= max_bs:
Expand Down Expand Up @@ -108,11 +118,12 @@ def autotune_batching_real_data(
inputs = {k: v.to(device) for k, v in inputs.items()}

# timing
torch.cuda.synchronize()
device_synchronize(device)
t0 = time.perf_counter()
with torch.no_grad():
_ = model(**inputs)
torch.cuda.synchronize()
device_synchronize(device)


total_time += time.perf_counter() - t0

Expand Down
5 changes: 1 addition & 4 deletions src/phold/features/predict_3Di.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@ def get_T5_model(
localfile = False
logger.info("ProstT5 not found. Downloading ProstT5 from Hugging Face")
try:
# suppress warning and progress bar
# suppress warning
logging.set_verbosity_error()
utils.logging.disable_progress_bar()
model = T5EncoderModel.from_pretrained(
model_name,
cache_dir=f"{model_dir}/",
Expand All @@ -155,9 +154,7 @@ def get_T5_model(
logger.warning("Download from Hugging Face failed. Trying backup from Zenodo.")
logdir = f"{model_dir}/logdir"
download_zenodo_prostT5(model_dir, logdir, threads)

logging.set_verbosity_error()
utils.logging.disable_progress_bar()

model = T5EncoderModel.from_pretrained(
model_name,
Expand Down
2 changes: 1 addition & 1 deletion src/phold/utils/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.4
1.2.5
Loading