add macos support

This commit is contained in:
2025-10-17 20:35:25 +08:00
parent 34102cf459
commit 576881116a
2 changed files with 84 additions and 27 deletions

View File

@@ -138,6 +138,22 @@ pixi install
pixi shell
```
不同机器使用配置方式:
```bash
# 在 Linux GPU 机器上安装和运行
pixi install --environment gpu
pixi run --environment gpu <your-task>
# 在 macOS 或 CPU 机器上安装和运行
pixi install --environment cpu
pixi run --environment cpu <your-task>
# 或使用默认环境(CPU)
pixi install
pixi run <your-task>
```
#### RDKit 安装建议
RDKit 推荐使用 conda 安装:
@@ -192,7 +208,20 @@ python utils/mole_predictor.py --help
```bash
# 预测 Frags-Enamine-18M.csv
python utils/mole_predictor.py Data/fragment/Frags-Enamine-18M.csv
# 创建测试文件(前 1001 行,包含表头)
head -1001 Data/fragment/Frags-Enamine-18M.csv > Data/fragment/test_1000.csv
# 测试命令 - 保守参数
nohup pixi run python utils/mole_predictor.py \
Data/fragment/test_1000.csv \
Data/fragment/test_1000_predicted.csv \
--device cuda:0 \
--batch-size 100 \
--n-workers 8 \
> Data/fragment/mole_test_1000.log 2>&1 &
# 查看日志
tail -f Data/fragment/mole_test_1000.log
# 预测 GDB11-27M.csv
python utils/mole_predictor.py Data/fragment/GDB11-27M.csv

View File

@@ -2,14 +2,15 @@
authors = ["hotwa <pylyzeng@gmail.com>"]
channels = ["conda-forge", "pytorch", "nvidia"]
name = "SIME"
platforms = ["linux-64"]
platforms = ["linux-64", "osx-64", "osx-arm64"] # 添加 macOS 平台
version = "0.1.0"
[tasks]
# 您的任务定义
# 默认依赖(所有环境共享)
[dependencies]
python = "3.12.*"
cuda-toolkit = { version = "12.8.*", channel = "nvidia" }
pandas = { version = ">=2.3.3,<3", channel = "conda-forge" }
xgboost = { version = ">=3.0.5,<4", channel = "conda-forge" }
pyyaml = { version = ">=6.0.3,<7", channel = "conda-forge" }
@@ -18,12 +19,39 @@ click = { version = ">=8.3.0,<9", channel = "conda-forge" }
openpyxl = { version = ">=3.1.5,<4", channel = "conda-forge" }
ipython = { version = ">=9.6.0,<10", channel = "conda-forge" }
[pypi-options]
# GPU feature (仅 Linux)
[feature.gpu]
platforms = ["linux-64"]
system-requirements = { cuda = "12" }
[feature.gpu.dependencies]
cuda-toolkit = { version = "12.8.*", channel = "nvidia" }
[feature.gpu.pypi-options]
extra-index-urls = ["https://download.pytorch.org/whl/cu128"]
[pypi-dependencies]
[feature.gpu.pypi-dependencies]
torch = "==2.8.0+cu128"
torchvision = "==0.23.0+cu128"
torchaudio = "==2.8.0+cu128"
torch-geometric = ">=2.5.0,<3"
rdkit = "*"
tqdm = ">=4.66.5,<5"
# CPU feature (macOS 和其他平台)
[feature.cpu]
platforms = ["osx-64", "osx-arm64", "linux-64"]
[feature.cpu.pypi-dependencies]
torch = "*" # CPU 版本
torchvision = "*"
torchaudio = "*"
torch-geometric = ">=2.5.0,<3"
rdkit = "*"
tqdm = ">=4.66.5,<5"
# 定义环境
[environments]
gpu = ["gpu"]
cpu = ["cpu"]
default = ["cpu"] # 默认使用 CPU