Skip to content

Commit feb6890

Browse files
committed
Windows: Instructions for building onnxruntime library
Signed-off-by: Tibor Vass <[email protected]>
1 parent 80beecb commit feb6890

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

README.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,17 @@ convolution support.
4747

4848
## Build from source
4949

50+
Requirements are: `git`, `cmake`, and your OS's preferred compiler suite.
51+
5052
Use this when cloning:
5153

5254
```
5355
git clone --recurse-submodules --shallow-submodules https://github.com/DamRsn/NeuralNote
5456
```
5557

58+
The following OS-specific build scripts have to be executed at least once before being able to use the project as a normal CMake project. The script downloads onnxruntime static library (that we created
59+
with [ort-builder](https://github.com/olilarkin/ort-builder)) before calling CMake.
60+
5661
#### Mac
5762

5863
```
@@ -61,13 +66,29 @@ $ ./build.sh
6166

6267
#### Windows
6368

69+
Due to [a known issue](https://github.com/DamRsn/NeuralNote/issues/21), if you're not using Visual Studio 2022 (MSVC version: 19.35.x, check `cl` output), then you'll need to manually build onnxruntime.lib like so:
70+
71+
1. Ensure you have Python installed; if not, download at https://www.python.org/downloads/windows/
72+
73+
2. Execute each of the following lines in a command prompt:
74+
6475
```
65-
> build.bat
76+
git clone --depth 1 --recurse-submodules --shallow-submodules https://github.com/tiborvass/libonnxruntime-neuralnote ThirdParty\onnxruntime
77+
cd ThirdParty\onnxruntime
78+
python3 -m venv venv
79+
.\venv\Scripts\activate.bat
80+
pip install -r requirements.txt
81+
.\convert-model-to-ort.bat model.onnx
82+
.\build-win.bat model.required_operators_and_types.with_runtime_opt.config
83+
cp model.with_runtime_opt.ort ..\..\Lib\ModelData\features_model.ort
84+
cd ..\..
6685
```
6786

68-
The build script has to be executed at least once before being able to use the project as a normal CMake project.
69-
The script downloads onnxruntime static library (that we created
70-
with [ort-builder](https://github.com/olilarkin/ort-builder)) before calling CMake.
87+
Now you can get back to building NeuralNote as follows:
88+
89+
```
90+
> .\build.bat
91+
```
7192

7293
#### IDEs
7394

@@ -86,7 +107,7 @@ But here's a description of the process we followed to create those files:
86107
- `features_model.onnx` was generated by converting a keras model containing only the CQT + Harmonic Stacking part of
87108
the full basic-pitch graph using `tf2onnx` (with manually added weights for batch normalization).
88109
- the `.json` files containing the weights of the basic-pitch cnn were generated from the tensorflow-js model available
89-
in the [basic-pitch-tf repository](https://github.com/spotify/basic-pitch-ts), then converted to onnx with `tf2onnx`.
110+
in the [basic-pitch-ts repository](https://github.com/spotify/basic-pitch-ts), then converted to onnx with `tf2onnx`.
90111
Finally, the weights were gathered manually to `.npy` thanks to [Netron](https://netron.app/) and finally applied to a
91112
split keras model created with [basic-pitch](https://github.com/spotify/basic-pitch) code.
92113

build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if "%extract%" == "true" (
2525
del %archive%
2626
)
2727

28-
wmic get cpu NumberOfLogicalProcessors | findstr /V NumberOfLogicalProcessors > ncpus
28+
wmic cpu get NumberOfLogicalProcessors | findstr /V NumberOfLogicalProcessors > ncpus
2929
set /p ncpus=<ncpus
3030
del ncpus
3131

0 commit comments

Comments
 (0)