-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix docker and add huggingface model (#237)
* update load model from huggingface * update load model from huggingface * fix data ndarray not list * docker free disk * add package push * docker replace conda to pip, fix path setup * add setuptools wheel twine in docker * add setuptools wheel twine in package * add cddir in next run * post1 and clean branch
- Loading branch information
Showing
11 changed files
with
112 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
FROM dptechnology/unicore:0.0.1-pytorch1.11.0-cuda11.3 | ||
|
||
RUN conda install -y -c conda-forge rdkit==2021.09.5 && conda clean -ya | ||
RUN pip install setuptools wheel twine | ||
|
||
RUN pip install rdkit-pypi==2021.9.5.1 | ||
|
||
RUN ldconfig && \ | ||
apt-get clean && \ | ||
apt-get autoremove && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* && \ | ||
conda clean -ya | ||
pip cache purge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .weighthub import weight_download, WEIGHT_DIR |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import os | ||
|
||
from ..utils import logger | ||
|
||
try: | ||
from huggingface_hub import snapshot_download | ||
except: | ||
huggingface_hub_installed = False | ||
def snapshot_download(*args, **kwargs): | ||
raise ImportError('huggingface_hub is not installed. If weights are not avaliable, please install it by running: pip install huggingface_hub. Otherwise, please download the weights manually from https://huggingface.co/dptech/Uni-Mol-Models') | ||
|
||
WEIGHT_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
os.environ["HF_ENDPOINT"] = "https://hf-mirror.com" # use mirror to download weights | ||
|
||
def weight_download(pretrain, save_path, local_dir_use_symlinks=True): | ||
if os.path.exists(os.path.join(save_path, pretrain)): | ||
logger.info(f'{pretrain} exists in {save_path}') | ||
return | ||
|
||
logger.info(f'Downloading {pretrain}') | ||
snapshot_download( | ||
repo_id="dptech/Uni-Mol-Models", | ||
local_dir=save_path, | ||
allow_patterns=pretrain, | ||
local_dir_use_symlinks=local_dir_use_symlinks, | ||
#max_workers=8 | ||
) | ||
|
||
# Download all the weights when this script is run | ||
def download_all_weights(local_dir_use_symlinks=False): | ||
logger.info(f'Downloading all weights to {WEIGHT_DIR}') | ||
snapshot_download( | ||
repo_id="dptech/Uni-Mol-Models", | ||
local_dir=WEIGHT_DIR, | ||
allow_patterns='*', | ||
local_dir_use_symlinks=local_dir_use_symlinks, | ||
#max_workers=8 | ||
) | ||
|
||
if '__main__' == __name__: | ||
download_all_weights() |