Code Monkey home page Code Monkey logo

Comments (4)

tszslovewanpu avatar tszslovewanpu commented on August 19, 2024 1

Got it!

from molgen.

ZJU-Fangyin avatar ZJU-Fangyin commented on August 19, 2024

Hi,

  1. Yes, all the experiments in the paper require the input of molecules, as the base model is the BART model.
  2. Your understanding is completely correct; this is a work on molecular optimization.

from molgen.

tszslovewanpu avatar tszslovewanpu commented on August 19, 2024

Thank you!
3、And how about MolGen 7B generate molecules? Is there any prompt gives to the trained model to start the generation process?
4、Does MolGen 7B designed for the 'generation from scratch' mission (generation and estimate the whole distribution, compare the distribution with the trainingset) or it can also complete the optimization mission?
Again thanks very much!

from molgen.

ZJU-Fangyin avatar ZJU-Fangyin commented on August 19, 2024
  1. MolGen 7B is capable of generating molecules from scratch. You can input a bos_token, or input an incomplete structure for the model to complete.

Denovo molecule generation example:

from transformers import AutoTokenizer, LlamaForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("zjunlp/MolGen-7b")
model = LlamaForCausalLM.from_pretrained(
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
sf_input = tokenizer(tokenizer.bos_token, return_tensors="pt").to(device)

molecules = model.generate(input_ids=sf_input["input_ids"],
sf_output = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=True).replace(" ","") for g in molecules]

Molecular completion example:

from transformers import AutoTokenizer, LlamaForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("zjunlp/MolGen-7b")
model = LlamaForCausalLM.from_pretrained(
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
sf_input = tokenizer("[C][N][O]", return_tensors="pt").to(device)

molecules = model.generate(input_ids=sf_input["input_ids"],
sf_output = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=True).replace(" ","") for g in molecules]
  1. MolGen 7B is primarily designed for tasks involving the de novo generation of molecules or the completion of molecular structures. However, by making appropriate modifications to the model's generate function, it can also support inputting molecular embeddings and can be used for optimization tasks as well.

from molgen.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.