{"id":15157642,"url":"https://github.com/pytorch/java-demo","last_synced_at":"2025-09-30T07:30:38.635Z","repository":{"id":48579560,"uuid":"232874533","full_name":"pytorch/java-demo","owner":"pytorch","description":null,"archived":true,"fork":false,"pushed_at":"2021-07-23T22:11:59.000Z","size":119,"stargazers_count":126,"open_issues_count":4,"forks_count":22,"subscribers_count":281,"default_branch":"master","last_synced_at":"2024-09-27T20:03:08.154Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pytorch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-09T18:13:13.000Z","updated_at":"2024-08-29T03:12:33.000Z","dependencies_parsed_at":"2022-09-23T18:51:27.881Z","dependency_job_id":null,"html_url":"https://github.com/pytorch/java-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytorch%2Fjava-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytorch%2Fjava-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytorch%2Fjava-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytorch%2Fjava-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pytorch","download_url":"https://codeload.github.com/pytorch/java-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234712843,"owners_count":18875521,"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","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":[],"created_at":"2024-09-26T20:01:30.138Z","updated_at":"2025-09-30T07:30:38.293Z","avatar_url":"https://github.com/pytorch.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyTorch Java Demo\n\nThis repository is a demonstration of how to use PyTorch from Java.\n\n## Setup\n\nDownload and unpack libtorch nightly (or 1.4 or greater).\nFrom the pytorch.org homepage under \"Quick Start Locally\",\nmake sure \"LibTorch\" is the selected package.\nLinux is supported as of version 1.4.\nMac is supported as of version 1.5.\nWindows is supported as of version 1.9.\nAll are both supported in nightly builds.\n\nRun `export LIBTORCH_HOME=/path/to/libtorch`.\nThe `build.gradle` file will use this to set `java.library.path`\nwhen running the application.\nIf you are using PyTorch in your own environment,\n`LIBTORCH_HOME` is not necessary.\nInstead, you will need to set `java.library.path` to `/path/to/libtorch/lib`.\n\nIt might be necessary to set the JAVA_HOME environment variable.\nOn Mac, use `export JAVA_HOME=$(/usr/libexec/java_home)`.\nOn Windows, with GitHub bash, try `export JAVA_HOME=/c/Progra~1/Java/jdk-*`\n\nOn Mac, you might get security errors.\nYou must manually approve execution for each library under libtorch.\nAs a shortcut, `xattr -r -d /path/to/libtorch/lib` might work.\n\nOn Windows, you will probably need to run\n`export PATH=\"$LIBTORCH_HOME/lib:$PATH\"`.\n\nIf using a nightly build, run `export USE_LIBTORCH_NIGHTLY=1`.\n\nRun `./gradlew run` to build and run the demo application.\nIt will load `demo-model.pt` and run it on some simple data.\n[This notebook](TorchScriptForJavaDemo.ipynb) was used to generate the model.\n\nMore information about the Java API and TorchScript:\n- [TorchScript tutorial](https://pytorch.org/tutorials/beginner/Intro_to_TorchScript_tutorial.html)\n- [TorchScript reference](https://pytorch.org/docs/stable/jit.html)\n- [Loading TorchScript in C++](https://pytorch.org/tutorials/advanced/cpp_export.html)\n- [JavaDoc](https://pytorch.org/javadoc/)\n- [PyTorch Android tutorial](https://pytorch.org/mobile/android/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpytorch%2Fjava-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpytorch%2Fjava-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpytorch%2Fjava-demo/lists"}