Skip to content

tae898/conceptnet5

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Running ConceptNet Locally on Docker

DOI

Watch the tutorial video at here.

This repo was forked from here.

The original build process is outlined here.

I tried to dockerize things as much as possible so that you can just pull the image and run it on your desired machine.

Pulling and running the Docker image (1.02GB compressed size, 2.488GB uncompressed size)

  1. Pull the latest image by

    docker pull tae898/conceptnet5

    Check out the original Dockerfile of this image, if interested.

  2. Run the docker container in detached mode. This will start postgres within.

    docker run --name conceptnet5 --network host -d tae898/conceptnet5
  3. Open up zsh (or bash, whatever you prefer) in the container by running

    docker exec -it conceptnet5 zsh
  4. Create a PostgreSQL database named conceptnet5 by running

    createdb conceptnet5
  5. Start the build by running

    ./build.sh

    This will take a long time since it has to download all the data. You need at least 30 GB of available RAM, 300 GB of free disk space, and the time and bandwidth to download 24 GB of raw data.

  6. Run the web server

    cd web
    pip install -e .
    python3 conceptnet_web/api.py
  7. Now you are ready to play around with the API!

    Try: http://127.0.0.1:8084/c/en/laptop?rel=/r/AtLocation&limit=1000

    Any HTTP request with the original server (e.g., https://conceptnet.io/c/en/laptop?rel=/r/AtLocation&limit=1000) will work on your local machine now. The only difference is that now the external server https://conceptnet.io is replaced with your local server http://127.0.0.1:8084.

  8. You can also make HTTP requests from a python client. Take a look at the client.py

    Be sure to install the requests package by running pip install requests

  9. When you are done with the API, you can safely turn off the Flask server and kill the docker container by

    docker kill conceptnet5

Running the docker container and the API agian

  1. When you are done you can just kill the container. And when you wanna start again, first run

    docker start conceptnet5

    Now the container conceptnet5 started in detached mode. Now run the Flask API server by

    docker exec -it -w /conceptnet5/web conceptnet5 python3 conceptnet_web/api.py
  2. Again when you are done, kill the container by

    docker kill conceptnet5

Troubleshooting

The best way to find and solve your problems is to see in the github issue tab. If you can't find what you want, feel free to raise an issue. We are pretty responsive.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Run make style && make quality in the root repo directory, to ensure code quality.
  4. Commit your Changes (git commit -m 'Add some AmazingFeature')
  5. Push to the Branch (git push origin feature/AmazingFeature)
  6. Open a Pull Request

Authors

About

Code for building ConceptNet from raw data.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dockerfile 44.4%
  • Python 44.4%
  • Makefile 11.2%