add cobra
This commit is contained in:
9
.gitmodules
vendored
9
.gitmodules
vendored
@@ -1,6 +1,9 @@
|
||||
[submodule "molscribe"]
|
||||
path = molscribe
|
||||
url = https://github.com/thomas0809/MolScribe
|
||||
[submodule "vary"]
|
||||
path = vary
|
||||
url = https://github.com/Ucas-HaoranWei/Vary
|
||||
[submodule "vary-toy"]
|
||||
path = vary-toy
|
||||
url = https://github.com/Ucas-HaoranWei/Vary-toy
|
||||
[submodule "cobra"]
|
||||
path = cobra
|
||||
url = https://github.com/h-zhao1997/cobra
|
||||
|
||||
171
README.md
171
README.md
@@ -1,93 +1,132 @@
|
||||
# ChemStructLM
|
||||
|
||||
ChemStructLM是一个旨在整合MolScribe和Vary库,让大语言模型能够理解、设计和改造化学结构、分子和蛋白质的项目。该项目通过在大语言模型中融合这两个强大的化学信息处理库,旨在推动化学和生物信息学领域的研究和应用。
|
||||
|
||||
## 特性
|
||||
|
||||
## Getting started
|
||||
整合了MolScribe和Vary库的功能。
|
||||
提供了一个示例环境,用于同时使用这两个库。
|
||||
包含了示例代码,展示如何将这两个库融合使用。
|
||||
开源,鼓励社区贡献。
|
||||
快速开始
|
||||
先决条件
|
||||
确保你有一个可用的Conda环境。如果没有,可以访问Miniconda或Anaconda官方网站了解如何安装。推荐使用micromamba作为包管理器。
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
## 安装
|
||||
|
||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||
克隆ChemStructLM仓库到你的本地机器:
|
||||
|
||||
## Add your files
|
||||
|
||||
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
||||
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
||||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin http://gitlab.dockless.eu.org/lingyuzeng/chemstructlm.git
|
||||
git branch -M main
|
||||
git push -uf origin main
|
||||
```shell
|
||||
git clone https://github.com/hotwa/ChemStructLM.git
|
||||
cd ChemStructLM
|
||||
```
|
||||
|
||||
## Integrate with your tools
|
||||
初始化子模块(MolScribe和Vary):
|
||||
|
||||
- [ ] [Set up project integrations](http://gitlab.dockless.eu.org/lingyuzeng/chemstructlm/-/settings/integrations)
|
||||
```shell
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
## Collaborate with your team
|
||||
检出MolScribe和Vary的特定版本:
|
||||
|
||||
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
||||
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
||||
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
||||
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
||||
```shell
|
||||
git submodule add https://github.com/thomas0809/MolScribe molscribe
|
||||
git submodule add https://github.com/Ucas-HaoranWei/Vary-toy vary-toy
|
||||
git submodule add https://github.com/h-zhao1997/cobra cobra
|
||||
cd molscribe
|
||||
git rev-parse HEAD
|
||||
git checkout 97acee57d10bd719f4dc1cfd30d09f142b7dc65f
|
||||
cd ../vary-toy
|
||||
git rev-parse HEAD
|
||||
git checkout e94e50f4b10c7b0f2a29e4d8b3804a35024b0565
|
||||
cd ..
|
||||
cd cobra
|
||||
git rev-parse HEAD
|
||||
git checkout 365a24d360f9c0d1ed4db96acc3a76b12782d138
|
||||
```
|
||||
|
||||
## Test and Deploy
|
||||
创建并激活Conda环境:
|
||||
|
||||
Use the built-in continuous integration in GitLab.
|
||||
```shell
|
||||
micromamba env create -f environment.yml
|
||||
micromamba run -n ChemStructLM python -m pip install -r requirements.txt -i https://pypi.mirrors.ustc.edu.cn/simple/
|
||||
# install flash-attention
|
||||
micromamba run -n ChemStructLM python -m pip install flash-attn --no-build-isolation
|
||||
# install vary
|
||||
cd vary/Vary-master
|
||||
# change pth path in source code
|
||||
# `vary/Vary-master/vary/demo/run_qwen_vary.py` and `vary/Vary-master/vary/model/vary_qwen_vary.py` in line `/cache/vit-large-patch14/`
|
||||
# download from https://huggingface.co/openai/clip-vit-large-patch14/tree/main
|
||||
sed -i 's|/cache/vit-large-patch14/|/media/lingyuzeng/c617029b-8496-684d-b402-a18f08e75ef13/project/Vary-toy/clip-vit-large-patch14/|g' vary/Vary-master/vary/demo/run_qwen_vary.py
|
||||
sed -i 's|/cache/vit-large-patch14/|/media/lingyuzeng/c617029b-8496-684d-b402-a18f08e75ef13/project/Vary-toy/clip-vit-large-patch14/|g' vary/Vary-master/vary/model/vary_qwen_vary.py
|
||||
sed -i 's/self.seq_length = config.seq_length/self.seq_length = config.max_length/' vary-toy/Vary-master/vary/model/llm/qwen/modeling_qwen.py
|
||||
micromamba run -n ChemStructLM python -m pip install e .
|
||||
# install molscribe
|
||||
cd ../../molscribe
|
||||
micromamba run -n ChemStructLM python -m pip install -r requirements.txt -i https://pypi.mirrors.ustc.edu.cn/simple/
|
||||
sed -i 's/timm==0.4.12/timm==0.6.13/' setup.py
|
||||
micromamba run -n ChemStructLM python setup.py install
|
||||
cd ..
|
||||
micromamba activate ChemStructLM
|
||||
# test
|
||||
python vary/Vary-master/vary/demo/run_qwen_vary.py --model-name /media/lingyuzeng/c617029b-8496-684d-b402-a18f08e75ef13/project/Vary-toy/clip-vit-large-patch14/ --image-file /mnt/wtrr1/deepinproject/chemstructlm/vary/assets/vary.png
|
||||
```
|
||||
|
||||
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
||||
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
||||
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
||||
test:
|
||||
|
||||
***
|
||||
```shell
|
||||
micromamba create -n test python=3.10 -y
|
||||
cd vary-toy/Vary-master
|
||||
micromamba run -n test python -m pip install e . -i https://pypi.mirrors.ustc.edu.cn/simple/
|
||||
cd ../../molscribe
|
||||
micromamba run -n test python setup.py install
|
||||
cd ..
|
||||
micromamba activate test
|
||||
```
|
||||
|
||||
# Editing this README
|
||||
MolScribe test:
|
||||
|
||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||
```shell
|
||||
import torch
|
||||
from molscribe import MolScribe
|
||||
# from huggingface_hub import hf_hub_download
|
||||
|
||||
## Suggestions for a good README
|
||||
# ckpt_path = hf_hub_download('yujieq/MolScribe', 'swin_base_char_aux_1m.pth')
|
||||
ckpt_path = '/mnt/wtrr1/deepinproject/MolScribe/ckpts/swin_base_char_aux_1m680k.pth'
|
||||
|
||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||
model = MolScribe(ckpt_path, device=torch.device('cpu'))
|
||||
output = model.predict_image_file('molscribe/assets/example.png', return_atoms_bonds=True, return_confidence=True)
|
||||
```
|
||||
|
||||
## Name
|
||||
Choose a self-explaining name for your project.
|
||||
[Cobra: Extending Mamba to Multi-modal Large Language Model for Efficient Inference](https://github.com/h-zhao1997/cobra)
|
||||
|
||||
## Description
|
||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||
安装:
|
||||
|
||||
## Badges
|
||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||
```shell
|
||||
cd cobra
|
||||
pip install -e .
|
||||
|
||||
## Visuals
|
||||
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
||||
# install mamba and other packages
|
||||
pip install packaging ninja
|
||||
pip install mamba-ssm
|
||||
pip install causal-conv1d
|
||||
|
||||
## Installation
|
||||
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
||||
# Verify Ninja --> should return exit code "0"
|
||||
ninja --version; echo $?
|
||||
```
|
||||
|
||||
## Usage
|
||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||
## 目录结构
|
||||
|
||||
## Support
|
||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||
|
||||
## Roadmap
|
||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||
|
||||
## Contributing
|
||||
State if you are open to contributions and what your requirements are for accepting them.
|
||||
|
||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||
|
||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||
|
||||
## Authors and acknowledgment
|
||||
Show your appreciation to those who have contributed to the project.
|
||||
|
||||
## License
|
||||
For open source projects, say how it is licensed.
|
||||
|
||||
## Project status
|
||||
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
||||
```shell
|
||||
YourProjectName/
|
||||
│
|
||||
├── src/ # 项目源代码
|
||||
│ ├── integration/ # 融合MolScribe和Vary的代码
|
||||
│ └── utils/ # 工具和辅助功能
|
||||
├── tests/ # 测试脚本
|
||||
├── vary/ # Vary项目作为子模块
|
||||
├── molscribe/ # MolScribe项目作为子模块
|
||||
├── environments/ # 环境配置文件,如conda环境文件
|
||||
├── README.md # 项目说明文件
|
||||
└── .gitmodules # git子模块配置文件
|
||||
```
|
||||
1
cobra
Submodule
1
cobra
Submodule
Submodule cobra added at 365a24d360
19
environment.yml
Normal file
19
environment.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
name: ChemStructLM
|
||||
channels:
|
||||
- conda-forge
|
||||
- fastai
|
||||
dependencies:
|
||||
- python=3.10 # 或其他版本,根据vary和molscribe共同兼容的版本
|
||||
- pymol-open-source
|
||||
- biopandas
|
||||
- biopython
|
||||
- ipython
|
||||
- jupyter
|
||||
- ipykernel
|
||||
- ipython
|
||||
- seaborn
|
||||
- jupyterlab
|
||||
- notebook
|
||||
- jupyterhub
|
||||
- nbclassic
|
||||
- requests
|
||||
31
requirements.txt
Normal file
31
requirements.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
einops==0.6.1
|
||||
einops-exts==0.0.4
|
||||
gradio_client==0.2.9
|
||||
OpenNMT-py==2.2.0
|
||||
deepspeed==0.12.3
|
||||
peft==0.4.0
|
||||
ninja
|
||||
torchaudio
|
||||
rdkit-pypi>=2021.03.2
|
||||
accelerate==0.24.1
|
||||
transformers==4.32.1
|
||||
bitsandbytes==0.41.0
|
||||
scikit-learn==1.2.2
|
||||
httpx==0.24.0
|
||||
tokenizers>=0.12.1
|
||||
markdown2[all]
|
||||
wandb
|
||||
shortuuid
|
||||
tiktoken
|
||||
sentencepiece==0.1.99
|
||||
torch
|
||||
torchvision
|
||||
numpy>=1.19.5
|
||||
pandas>=1.2.4
|
||||
matplotlib>=3.5.3
|
||||
opencv-python==4.5.5.64
|
||||
huggingface-hub>=0.11.0
|
||||
tensorboardX
|
||||
SmilesPE==0.0.3
|
||||
albumentations @ git+https://github.com/albumentations-team/albumentations@37e714fd2e326f6f88778e425f98c2de8c8d5372
|
||||
timm @ git+https://github.com/rwightman/pytorch-image-models.git@54a6cca27a9a3e092a07457f5d56709da56e3cf5
|
||||
1
vary
1
vary
Submodule vary deleted from 9727432512
1
vary-toy
Submodule
1
vary-toy
Submodule
Submodule vary-toy added at e94e50f4b1
Reference in New Issue
Block a user