Giter Site home page Giter Site logo

chemcrow-fork's Introduction

tests PyPI PyPI - Python Version DOI:10.1101/2020.07.15.204701

ChemCrow logo



ChemCrow is an open source package for the accurate solution of reasoning-intensive chemical tasks.

Built with Langchain, it uses a collection of chemical tools including RDKit, paper-qa, as well as some relevant databases in chemistry, like Pubchem and chem-space.

๐Ÿค— Try it out in HuggingFace!

ChemCrow Demo

โš ๏ธ Note

This package does not contain all the tools described in the ChemCrow paper because of API usage restrictions. This repo will not give the same results as that paper.

All the experiments have been released under ChemCrow runs.

๐Ÿ‘ฉโ€๐Ÿ’ป Installation

pip install chemcrow

or for development:

conda create -n chemcrow python=3.9

conda activate chemcrow

CUDACXX=/usr/local/cuda-12.1/bin/nvcc CMAKE_ARGS="-DLLAMA_CUBLAS=on -DCMAKE_CUDA_ARCHITECTURES=native" FORCE_CMAKE=1 proxychains pip install llama-cpp-python --no-cache-dir --force-reinstall --upgrade

pip install -e .

pip install -r dev-requirements.txt

๐Ÿ”ฅ Usage

First set up your API keys in your environment.

export OPENAI_API_KEY=your-openai-api-key

You can optionally use Serp API:

export SERP_API_KEY=your-serpapi-api-key

In a Python session:

from chemcrow.agents import ChemCrow

chem_model = ChemCrow(model="gpt-4-0613", temp=0.1, streaming=False)
chem_model.run("What is the molecular weight of tylenol?")

๐Ÿ’ป Running on a local machine

You can also use the program by loading a LlamaCpp (.gguf) or GPT4ALL (.bin) model as the LLM instead of using the OpenAI API.

from chemcrow.agents import ChemCrow

chem_model = ChemCrow(model="./models/llama-2-7b.Q8_0.gguf", 
                      tools_model="./models/llama-2-7b.Q8_0.gguf", 
                      temp=0.1, verbose=False, max_tokens=100, n_ctx=2048)
output = chem_model.run("What is the molecular weight of tylenol?")

>>> output
>>> The molecular weight of acetaminophen is 151.17 g/mol ...

โœ… Citation

Bran, Andres M., et al. "ChemCrow: Augmenting large-language models with chemistry tools." arXiv preprint arXiv:2304.05376 (2023).

@article{bran2023chemcrow,
      title={ChemCrow: Augmenting large-language models with chemistry tools},
      author={Andres M Bran and Sam Cox and Oliver Schilter and Carlo Baldassari and Andrew D White and Philippe Schwaller},
      year={2023},
      eprint={2304.05376},
      archivePrefix={arXiv},
      primaryClass={physics.chem-ph},
      publisher={arXiv}
}

chemcrow-fork's People

Contributors

doncamilom avatar avanteijlingen avatar vaaaas avatar whitead avatar samcox822 avatar

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.