diff options
author | Roman Grundkiewicz <rgrundkiewicz@gmail.com> | 2022-02-09 15:59:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-09 15:59:03 +0300 |
commit | 0ca966eadd2a4885a10d41e0f2f51445ab6fd038 (patch) | |
tree | eab14a372d13c4291b0fa744bb7e93f373e8e0cf | |
parent | 299123b00005d71867d4dde52e5e8f806b1caef4 (diff) | |
parent | ac2f162fd731a38531bdbd36ae5b4d529ee16330 (diff) |
Merge pull request #25 from marian-nmt/romang/example-library-readme
Replace the marian-example-library submodule with README
-rw-r--r-- | .gitmodules | 4 | ||||
m--------- | example-library | 0 | ||||
-rw-r--r-- | example-library/README.md | 57 |
3 files changed, 57 insertions, 4 deletions
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 -Subproject a33ef1055cbb3b7a8003138e9669d406a7bde42 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. + +<!-- Links --> +[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 |