Skip to content

Commit

Permalink
Docs (#200)
Browse files Browse the repository at this point in the history
* docs start

* new start

* add .readthedocs.yml

* update .readthedoc.yml

* update

* 1

* 2

* update requirement for docs

* rst to md

* add mds

* update requirements installation tutorial

* update docs

* add task/model docs (#195)

task&model docs

* add docs for task and model

* update model and task

* update

* update

* add doc (#197)

Co-authored-by: nobody <nobody>

* add utils and update

* init docs of interface (#198)

* update train-predict

* update doc of Data

* add data

* update predict

* update readme

* update readme

---------

Co-authored-by: cuiyaning <[email protected]>
Co-authored-by: Cody Zhao <[email protected]>
Co-authored-by: robotcator <[email protected]>
Co-authored-by: Zhifeng Gao <[email protected]>
Co-authored-by: hswang <[email protected]>
  • Loading branch information
6 people authored Dec 26, 2023
1 parent 5a9f8fe commit d93441d
Show file tree
Hide file tree
Showing 34 changed files with 1,570 additions and 93 deletions.
28 changes: 28 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py


# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Uni-Mol tools is a easy-use wrappers for property prediction,representation and

Check this [subfolder](./unimol_tools/) for more detalis.

Documentation of Uni-Mol tools is available at https://unimol.readthedocs.io/en/latest/

News
----
**Jul 7 2023**: We update a new version of Uni-Mol+, including the model setting for OC20 and a better performance on PCQM4MV2.
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
27 changes: 27 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Packages required to build docs, independent of application dependencies

-e ./unimol_tools

sphinx

sphinx_rtd_theme==2.0.0rc2
sphinx-tabs
sphinx-intl
sphinx-design
sphinx-multiproject

# RTD deps :)
readthedocs-sphinx-search
sphinx-hoverxref
sphinx-notfound-page

# Docs
sphinxemoji
sphinxcontrib-httpdomain
sphinx-prompt
sphinx-autobuild
sphinxext-opengraph
sphinx-copybutton

# Markdown
myst_parser
60 changes: 60 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'Uni-Mol tools'
copyright = '2023, cuiyaning'
author = 'cuiyaning'
release = '0.1.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'myst_parser',
]

templates_path = ['_templates']
exclude_patterns = []

highlight_language = 'python'


# List of modules to be mocked up. This is useful when some external
# dependencies are not met at build time and break the building process.
autodoc_mock_imports = [
'rdkit',
'unicore',
'torch',
'sklearn',
]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']

# -- Autodoc configuration ---------------------------------------------------

autoclass_content = 'class'

# 显式地设置成员的顺序,确保构造函数的参数首先显示
autodoc_member_order = 'bysource'

# 设置构造函数的默认选项,包括显示参数

autodoc_default_options = {
'members': True,
'special-members': '__init__',
#'undoc-members': False,
'private-members': True,
#'show-inheritance': False,
}
36 changes: 36 additions & 0 deletions docs/source/data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Data
====

`unimol_tools.data <https://github.com/dptech-corp/Uni-Mol/tree/docs/unimol_tools/unimol_tools/data>`_ contains functions and classes for loading, containing, and scaler data, feature.

DataHub
-------

Classes and functions from `unimol_tools.data.datahub.py <https://github.com/dptech-corp/Uni-Mol/tree/docs/unimol_tools/unimol_tools/data/datahub.py>`_.

.. automodule:: unimol_tools.data.datahub
:members:

Datareader
----------

Classes and functions from `unimol_tools.data.datareader.py <https://github.com/dptech-corp/Uni-Mol/tree/docs/unimol_tools/unimol_tools/data/datareader.py>`_.

.. automodule:: unimol_tools.data.datareader
:members:

Datascaler
-----------

Classes and functions from `unimol_tools.data.datascaler.py <https://github.com/dptech-corp/Uni-Mol/tree/docs/unimol_tools/unimol_tools/data/datascaler.py>`_.

.. automodule:: unimol_tools.data.datascaler
:members:

Conformer
---------

Classes and functions from `unimol_tools.data.conformer.py <https://github.com/dptech-corp/Uni-Mol/tree/docs/unimol_tools/unimol_tools/data/conformer.py>`_.

.. automodule:: unimol_tools.data.conformer
:members:
3 changes: 3 additions & 0 deletions docs/source/features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# New Features

## Coming Soon...
34 changes: 34 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.. UniMol documentation master file, created by
sphinx-quickstart on Wed Nov 29 03:53:18 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Uni-Mol tools' documentation!
==========================================

Uni-Mol tools is a easy-use wrappers for property prediction,representation and downstreams with Uni-Mol. It includes the following tools:

* molecular property prediction with Uni-Mol.
* molecular representation with Uni-Mol.
* other downstreams with Uni-Mol.

.. toctree::
:maxdepth: 2
:caption: Contents:

requirements
installation
tutorial
train
data
models
task
utils
features

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
33 changes: 33 additions & 0 deletions docs/source/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Installation

## Overview

[Uni-Mol](https://github.com/dptech-corp/Uni-Mol/tree/main)
now can be installed from source.
```shell
## unicore and other dependencies installation
pip install -r requirements.txt
## clone repo
git clone https://github.com/dptech-corp/Uni-Mol.git
cd Uni-Mol/unimol_tools/unimol_tools

## download pretrained weights
wget https://github.com/dptech-corp/Uni-Mol/releases/download/v0.1/mol_pre_all_h_220816.pt
wget https://github.com/dptech-corp/Uni-Mol/releases/download/v0.1/mol_pre_no_h_220816.pt
wget https://github.com/dptech-corp/Uni-Mol/releases/download/v0.1/pocket_pre_220816.pt
wget https://github.com/dptech-corp/Uni-Mol/releases/download/v0.1/mof_pre_no_h_CORE_MAP_20230505.pt
wget https://github.com/dptech-corp/Uni-Mol/releases/download/v0.1/mp_all_h_230313.pt
wget https://github.com/dptech-corp/Uni-Mol/releases/download/v0.1/oled_pre_no_h_230101.pt

mkdir -p weights
mv *.pt weights/

## install
cd ..
python setup.py install
```

## Bohrium notebook

Uni-Mol images can be avaliable on the online notebook platform [Bohirum notebook](https://nb.bohrium.dp.tech/).

39 changes: 39 additions & 0 deletions docs/source/models.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.. _models:

Models
======

`unimol_tools.models <https://github.com/dptech-corp/Uni-Mol/blob/docs/unimol_tools/unimol_tools/models>`_ contains the models of Uni-Mol.


Uni-Mol
-------

`unimol_tools.models.unimol.py <https://github.com/dptech-corp/Uni-Mol/blob/docs/unimol_tools/unimol_tools/models/unimol.py>`_ contains the :class:`~unimol_tools.models.UniMolModel`, which is the backbone of Uni-Mol model.

.. automodule:: unimol_tools.models.unimol
:members:

Model
-----

`unimol_tools.models.nnmodel.py <https://github.com/dptech-corp/Uni-Mol/blob/docs/unimol_tools/unimol_tools/models/unimol.py>`_ contains the :class:`~unimol_tools.models.NNModel`, which is responsible for initializing the model.

.. automodule:: unimol_tools.models.nnmodel
:members:

Loss
-----

`unimol_tools.models.loss.py <https://github.com/dptech-corp/Uni-Mol/blob/docs/unimol_tools/unimol_tools/models/loss.py>`_ contains different loss functions.

.. automodule:: unimol_tools.models.loss
:members:

Transformers
------------

`unimol_tools.models.transformers.py <https://github.com/dptech-corp/Uni-Mol/blob/docs/unimol_tools/unimol_tools/models/transformers.py>`_ contains a custom Transformer Encoder module that extends `PyTorch's nn.Module <https://pytorch.org/docs/stable/generated/torch.nn.Module.html>`_.

.. automodule:: unimol_tools.models.transformers
:members:
8 changes: 8 additions & 0 deletions docs/source/requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Requirements

For small datasets (~1000 molecules), it is possible to train models within a few minutes on a standard laptop with CPUs only. However, for larger datasets and larger Uni-Mol models, we recommend using a GPU for significantly faster training.

Notice: [Uni-Core](https://github.com/dptech-corp/Uni-Core) is needed, please install it first. Current Uni-Core requires torch>=2.0.0 by default, if you want to install other version, please check its [Installation Documentation](https://github.com/dptech-corp/Uni-Core#installation).


Uni-Mol is uses Python 3.8+ and all models are built with [PyTorch](https://pytorch.org/). See [Installation](#installation) for details on how to install Uni-Mol and its dependencies.
23 changes: 23 additions & 0 deletions docs/source/task.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.. _tasks:

Task
======

`unimol_tools.tasks <https://github.com/dptech-corp/Uni-Mol/blob/docs/unimol_tools/unimol_tools/tasks>`_ oversees the tasks related to the model, such as training and prediction.


Trainer
-------

`unimol_tools.tasks.trainer.py <https://github.com/dptech-corp/Uni-Mol/blob/docs/unimol_tools/unimol_tools/tasks/trainer.py>`_ contains the :class:`~unimol_tools.unimol_tools.models.tasks.Trainer`, managing the training, validation, and testing phases.

.. automodule:: unimol_tools.tasks.trainer
:members:

Split
-------

`unimol_tools.tasks.split.py <https://github.com/dptech-corp/Uni-Mol/blob/docs/unimol_tools/unimol_tools/tasks/split.py>`_ manages the split methods in the dataset.

.. automodule:: unimol_tools.tasks.split
:members:
Loading

0 comments on commit d93441d

Please sign in to comment.