{"id":29922057,"url":"https://github.com/valohai/dl4j-nlp-cuda-example","last_synced_at":"2025-08-02T08:45:02.692Z","repository":{"id":43063276,"uuid":"217515687","full_name":"valohai/dl4j-nlp-cuda-example","owner":"valohai","description":"A git repository containing an NLP example using DL4J (cuda) in Java","archived":false,"fork":false,"pushed_at":"2022-09-26T09:51:10.000Z","size":573,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-01T21:07:17.228Z","etag":null,"topics":["cuda","cuda-details","cudnn","deep-learning","deeplearning4j","dl4j","docker-container","java","jvm","machine-learning","natural-language-processing","nlp","nvidia","nvidia-drivers","nvidia-gpu","valohai-cli","valohai-platform"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valohai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-25T11:05:54.000Z","updated_at":"2022-09-26T09:51:14.000Z","dependencies_parsed_at":"2023-01-18T14:30:17.083Z","dependency_job_id":null,"html_url":"https://github.com/valohai/dl4j-nlp-cuda-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/valohai/dl4j-nlp-cuda-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valohai%2Fdl4j-nlp-cuda-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valohai%2Fdl4j-nlp-cuda-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valohai%2Fdl4j-nlp-cuda-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valohai%2Fdl4j-nlp-cuda-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valohai","download_url":"https://codeload.github.com/valohai/dl4j-nlp-cuda-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valohai%2Fdl4j-nlp-cuda-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268356088,"owners_count":24237380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","cuda-details","cudnn","deep-learning","deeplearning4j","dl4j","docker-container","java","jvm","machine-learning","natural-language-processing","nlp","nvidia","nvidia-drivers","nvidia-gpu","valohai-cli","valohai-platform"],"created_at":"2025-08-02T08:45:02.125Z","updated_at":"2025-08-02T08:45:02.661Z","avatar_url":"https://github.com/valohai.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DL4J NLP examples [![NLP using DL4J](https://img.shields.io/docker/pulls/neomatrix369/dl4j-nlp-cuda.svg)](https://hub.docker.com/r/neomatrix369/dl4j-nlp-cuda) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n\nThis area in the repo is a result of the blog post [Applying NLP in Java, all from the command-line](https://medium.com/@neomatrix369/applying-nlp-in-java-all-from-the-command-line-1225dd591e80) | [Original post](https://valohai.com/blog/nlp_with_dl4j_in_java_all_from_the_command-line?from=3oxenia9mtr6). Please refer to the post before considering using this repo to understand better on how to use the different aspects of it.\n\n---\n\nOpen built-in Terminal from the IntelliJ IDEA. \nIf you prefer, use the terminal app on your computer.\nIn the terminal window, `cd` to the project root directory `dl4j-nlp-cuda-example` if not already in.\n(_you can use IDE's run-configuration green run button, if you like._)\n\n### Quick startup\n\n- open an account on [https://valohai.com](), see [https://app.valohai.com/accounts/signup/]()\n- [install Valohai CLI](https://docs.valohai.com/tutorials/quick-start-cli.html?highlight=cli) on your local machine\n- clone _this repo (https://github.com/.../dl4j-nlp-cuda-example/)_\n```bash\n    $ git clone [url to this repo]\n    $ cd dl4j-nlp-cuda-example\n```\n- create a Valohai project using the [Valohai CLI](https://docs.valohai.com/tutorials/quick-start-cli.html?highlight=cli) tool, and give it a name\n```bash\n    $ vh project create\n```\n- link your Valohai project with the _url to this github repo_ on the Repository tab of the Settings page (https://app.valohai.com/p/[your-user-id]/dl4j-nlp-cuda-example/settings/repository/)\n```bash\n    $ vh project open\n    \n    ### Go to the Settings page \u003e Repository tab and update the git repo address with this git repo: https://github.com/.../dl4j-nlp-cuda-example/\n```\n- update Valohai project with the latest commits from the git repo\n```bash\n    $ vh project fetch\n```\n\nAnd you are ready to start using the power of performing Machine Learning tasks from the command-line.\n\n### Advanced installation and setup\n\nTo be able to run the apps and tasks we will cover in this project on your local machine (in addition to using the Valohai platform) we would need to have the below installed and configured on your local machine (how to do each one of these are outside the scope of the project, although links to resources are provided):\n\n**_Build and run app on local machine_**\n- Git\n- Python 2.7 or Python 3.4 or higher\n- GraalVM CE 19.2.1 or higher (download from [https://github.com/oracle/graal/releases]())\n- Maven 3.6.0 or higher\n\n**_Build and run app inside a docker container_**\n- Docker CE 19.03.2 or higher\n\n**_Do the above and make use of GPUs - CUDA, cuDNN, etc._**\n- Nvidia, CUDA 10.1 and cuDNN (7.0) drivers version (Linux and Windows machines only, support for MacOS is unavailable) (see [Resources](#resoures) at the bottom of this post for download and installation [details on GPUs, CUDA, cuDNN, etc...](./docs/gpu-related-resources.md))\n\n#### Valohai CLI installation and Valohai project setup\n\nSee [Valohai CLI installation and Valohai project setup](./docs/valohai-setup.md)\n\n#### Build the app using the Valohai platform\n\nSee [Build the app using the Valohai platform](./docs/valohai-build-app.md)\n\n#### Gathering Nvidia GPU, Nvidia drivers, CUDA details\n\n```bash\n$ vh exec run know-your-gpus\n```\n\nWill run a bunch of commands to gather Nvidia GPU, Nvidia drivers, CUDA details on a machine, this step is also used by other steps. The captured result is stored in a log file and archive after each run. See [GPU related resources](./docs/gpu-related-resources.md)\n\n#### Build the app on the local machine\n\n##### CPU version\n\n```bash\n$ BACKEND=cpu ./buildUberJar.sh\n```\n\n##### GPU version\n\n**Note:** please ensure you have access to an Nvidia GPU and the necessary drivers i.e. CUDA, cuDNN etc... are installed, see [GPU related resources](./docs/gpu-related-resources.md).\n\n```bash\n$ BACKEND=gpu ./buildUberJar.sh\n```\n\n#### Run the app on the local machine\n\nSee [Run the app on the local machine](./docs/running-local-machine.md)\n\n#### Building the docker container to run CUDA-enabled Java apps\n\nSee [Building the docker container to run CUDA-enabled Java apps](./docs/docker-cuda-app.md)\n\n#### Run app in docker container\n\n```bash\n$ cd dl4j-nlp-cuda-example/docker\n$ ./docker-runner --runContainer   ### neomatrix369 or DOCKER_USER_NAME is set to your Docker Hub username \n\nor\n\n$ ./docker-runner --dockerUserName [neomatrix369 or your Docker Hub username] \\\n                  --runContainer\n```\n\nAt the prompt in the container, do the same as mentioned in section [Run app on your local machine](#run-app-on-the-local-machine).\n\nYou would use your Docker Hub username only when you have an Docker image with your username available locally or on Docker Hub.\n\n### Running other examples on the local machine\n\nSee [Running other examples on the local machine](./docs/running-other-examples.md)\n\n## Credits\n\nThis example has been inspired by the DL4J NLP examples: [nlp](https://github.com/eclipse/deeplearning4j-examples/tree/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/nlp) | [convolution: sentence classifier](https://github.com/eclipse/deeplearning4j-examples/tree/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/convolution/sentenceclassification) | [recurrent: character](https://github.com/eclipse/deeplearning4j-examples/tree/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/recurrent/character) | [recurrent: process news](https://github.com/eclipse/deeplearning4j-examples/tree/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/recurrent/processnews) | [recurrent: word2vec and sentiment analysis](https://github.com/eclipse/deeplearning4j-examples/tree/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/recurrent/word2vecsentiment ) examples from DL4J. Credits to the original authors of this example on https://github.com/deeplearning4j/dl4j-examples.\n\n## License\n\nOriginal authors of this DL4J example project remain the license holders of the work, although the original work has been modified to a good extent, and the Apache 2.0 License is cited for all those file/files in the matter (see [License.txt](License.txt) in the root of the project). Exception to the above: four bash scripts have been authored by Mani Sarkar and have been cited under the Apache 2.0 license.\n\n### Resources\n\n- [dl4j-nlp-cuda-example](https://github.com/valohai/dl4j-nlp-cuda-example) project on GitHub\n- [CUDA enabled docker container](https://hub.docker.com/r/neomatrix369/dl4j-nlp-cuda) on [Docker Hub](https://hub.docker.com) (use the latest tag: [v0.5](https://hub.docker.com/layers/neomatrix369/dl4j-nlp-cuda/v0.5/images/sha256-fcfcc2dcdf00839d918a0c475c39733d777181abb1a3c34d8dea68339369b137))\n- [GPU, Nvidia, CUDA and cuDNN](./docs/gpu-related-resources.md)\n- [Awesome AI/ML/DL resources](https://github.com/neomatrix369/awesome-ai-ml-dl/)\n- [Java AI/ML/DL resources](https://github.com/neomatrix369/awesome-ai-ml-dl/blob/master/README-details.md#java)\n- [Deep Learning and DL4J Resources](https://github.com/neomatrix369/awesome-ai-ml-dl/blob/master/README-details.md#deep-learning)\n    - **Awesome AI/ML/DL:** [NLP resources](https://github.com/neomatrix369/awesome-ai-ml-dl/tree/master/natural-language-processing#natural-language-processing-nlp)\n    - **DL4J NLP resources**\n        - [Language processing](https://deeplearning4j.org/docs/latest/deeplearning4j-nlp-overview)\n            - [ND4J backends for GPUs and CPUs](https://deeplearning4j.org/docs/latest/deeplearning4j-config-gpu-cpu)\n            - [How the Vocab Cache Works](https://deeplearning4j.org/docs/latest/deeplearning4j-nlp-vocabulary-cache)\n            - [Word2Vec, Doc2vec \u0026 GloVe: Neural Word Embeddings for Natural Language Processing](https://deeplearning4j.org/docs/latest/deeplearning4j-nlp-word2vec)\n            - [Doc2Vec, or Paragraph Vectors, in Deeplearning4j](https://deeplearning4j.org/docs/latest/deeplearning4j-nlp-doc2vec)\n            - [Sentence iterator](https://deeplearning4j.org/docs/latest/deeplearning4j-nlp-sentence-iterator)\n            - [What is Tokenization?](https://deeplearning4j.org/docs/latest/deeplearning4j-nlp-tokenization)\n        - Examples\n            - https://github.com/eclipse/deeplearning4j-examples/tree/master/dl4j-examples\n            - https://github.com/eclipse/deeplearning4j/tree/master/deeplearning4j/deeplearning4j-nlp-parent\n- **Valohai resources**\n    - [valohai](https://www.valohai.com/) | [docs](https://docs.valohai.com/) | [blogs](https://valohai.com/blog/) | [GitHub](https://github.com/valohai) | [Videos](https://www.youtube.com/channel/UCiR8Fpv6jRNphaZ99PnIuFg/videos) | [Showcase](https://valohai.com/showcase/) | [About valohai](https://github.com/neomatrix369/awesome-ai-ml-dl/blob/master/data/about-Valohai.md#valohai) | [Slack](http://community-slack.valohai.com/) | [@valohaiai](https://twitter.com/@valohaiai)\n    - [Search for any topic in the Documentation](https://docs.valohai.com/search.html?q=%3Cany+topic%3E)\n    - Blog posts on how to use the Valohai CLI tool: [[1]](https://valohai.com/blog/from-zero-to-hero-with-valohai-cli) | [[2]](https://valohai.com/blog/from-zero-to-hero-with-valohai-part-2)\n    - [Custom Docker Images](https://docs.valohai.com/guides/build-docker-image.html)\n- Other resources\n  - [Awesome Graal](https://github.com/neomatrix369/awesome-graal) | [graalvm.org](https://www.graalvm.org/)\n- Other related posts\n    - [How to do Deep Learning for Java on the Valohai Platform?](https://valohai.com/blog/how-to-do-deep-learning-for-java-on-the-valohai-platform)\n    - Blog posts on how to use the Valohai CLI tool: [[1]](https://valohai.com/blog/from-zero-to-hero-with-valohai-cli) | [[2]](https://valohai.com/blog/from-zero-to-hero-with-valohai-part-2)\n\n---\n\nReturn to [Awesome AI/ML/DL](https://github.com/neomatrix369/awesome-ai-ml-dl#awesome-ai-ml-dl-)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalohai%2Fdl4j-nlp-cuda-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalohai%2Fdl4j-nlp-cuda-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalohai%2Fdl4j-nlp-cuda-example/lists"}