From ac2f162fd731a38531bdbd36ae5b4d529ee16330 Mon Sep 17 00:00:00 2001 From: Roman Grundkiewicz Date: Wed, 9 Feb 2022 12:23:58 +0000 Subject: Do not use marian-example-library as a submodule --- .gitmodules | 4 ---- example-library | 1 - example-library/README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 5 deletions(-) delete mode 100644 .gitmodules delete mode 160000 example-library create mode 100644 example-library/README.md diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 3ddbd40..0000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "example-library"] - path = example-library - url = https://github.com/marian-nmt/marian-example-library - branch = main diff --git a/example-library b/example-library deleted file mode 160000 index a33ef10..0000000 --- a/example-library +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a33ef1055cbb3b7a8003138e9669d406a7bde42f diff --git a/example-library/README.md b/example-library/README.md new file mode 100644 index 0000000..b2bf5be --- /dev/null +++ b/example-library/README.md @@ -0,0 +1,57 @@ +# Example: Marian as a library + +This serves as a minimal example of a CMake project with a [marian][marian] +dependency. The dependency to Marian in that repository is facilitated by a +submodule to [marian-dev]. The complete code is available from the +[marian-example-library] repository. + + +## Usage + +### Compile +```shell +git clone https://github.com/marian-nmt/marian-example-library +cd marian-example-library +mkdir build +cd build +cmake .. +cmake --build . +``` + +### Run +```shell +./example +``` + +## About this example +The code in [src/main.cpp](src/main.cpp) builds a simple expression graph using +Marian. It mirrors the example found in Marian's [developer +documentation][dev_docs]. + +The expression graph represents `z = x*y + sin(x)`, with an absolute-error +applied to `z` as a loss function. It performs a forward and backward +evaluation of the graph, and a single update of the graph parameters from a +`Stochastic Gradient Descent` optimizer. Following the example, `x` takes the +place of a learnable parameter. + +After the parameter update, the graph parameters are saved to +`example-model.npz`. You can inspect its contents with +[`script/read-npz.py`](/script/read-npz.py). + +Please refer to the [marian][marian] project for further documentation. + +## About this repository +There are example CI builds available for + - Ubuntu + - MacOS + - Windows + +These compile and run the example executable. + +Additionally, the Marian submodule is updatable via dependabot. + + +[marian]: https://marian-nmt.github.io/ +[marian-dev]: https://github.com/marian-nmt/marian-dev +[marian-example-library]: https://github.com/marian-nmt/marian-example-library +[dev_docs]: https://marian-nmt.github.io/docs/api/graph.html -- cgit v1.2.3