some fixing for python package (#401)
This commit is contained in:
Родитель
db87dc416d
Коммит
26dda4eb74
21
README.md
21
README.md
|
@ -6,21 +6,22 @@
|
|||
|
||||
Introduction: ONNXRuntime-Extensions is a library that extends the capability of the ONNX models and inference with ONNX Runtime, via ONNX Runtime Custom Operator ABIs. It includes a set of [ONNX Runtime Custom Operator](https://onnxruntime.ai/docs/reference/operators/add-custom-op.html) to support the common pre- and post-processing operators for vision, text, and nlp models. And it supports multiple languages and platforms, like Python on Windows/Linux/macOS, some mobile platforms like Android and iOS, and Web-Assembly etc. The basic workflow is to enhance a ONNX model firstly and then do the model inference with ONNX Runtime and ONNXRuntime-Extensions package.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>⚠️</td>
|
||||
<td>
|
||||
<strong>NOTE:</strong> most ONNXRuntime-Extensions packages are in <strong><em>active development</em></strong> and most packages require building from source. The package information will be updated here if it is published.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Quickstart with the experimental Python package
|
||||
## Quickstart
|
||||
|
||||
### **Python installation**
|
||||
```bash
|
||||
pip install onnxruntime-extensions
|
||||
````
|
||||
|
||||
|
||||
### **nightly build**
|
||||
|
||||
#### <strong>on Windows</strong>
|
||||
```bash
|
||||
```cmd
|
||||
pip install --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/pypi/simple/ onnxruntime-extensions
|
||||
```
|
||||
Please ensure that you have met the prerequisites of onnxruntime-extensions (e.g., onnx and onnxruntime) in your Python environment.
|
||||
#### <strong>on Linux/macOS</strong>
|
||||
the packages are not ready yet, so it could be installed from source. Please make sure the compiler toolkit like gcc(later than g++ 8.0) or clang, and the tool <strong>cmake</strong> are installed before the following command
|
||||
```bash
|
||||
|
|
|
@ -201,8 +201,10 @@ def merge_models(core: str, output_model:str, audio_data):
|
|||
print("Verify the final model...")
|
||||
m_final = PyOrtFunction.from_model(output_model)
|
||||
output_text = m_final(audio_data,
|
||||
np.asarray([200]),
|
||||
np.asarray([0]), np.asarray([2]), np.asarray([1]),
|
||||
np.asarray([200], dtype=np.int32),
|
||||
np.asarray([0], dtype=np.int32),
|
||||
np.asarray([2], dtype=np.int32),
|
||||
np.asarray([1], dtype=np.int32),
|
||||
np.asarray([1.0], dtype=np.float32), np.asarray([1.0], dtype=np.float32),
|
||||
np.zeros((1, N_MELS, N_FRAMES)).astype(np.int32))
|
||||
print(output_text)
|
||||
|
@ -257,9 +259,13 @@ if __name__ == '__main__':
|
|||
input_features = log_mel
|
||||
# similar to:
|
||||
# generated_ids = model.generate(torch.from_numpy(input_features)).numpy()
|
||||
ort_outputs = model(input_features, np.asarray([200]),
|
||||
np.asarray([0]), np.asarray([2]), np.asarray([1]),
|
||||
np.asarray([1.0], dtype=np.float32), np.asarray([1.0], dtype=np.float32),
|
||||
ort_outputs = model(input_features,
|
||||
np.asarray([200], dtype=np.int32),
|
||||
np.asarray([0], dtype=np.int32),
|
||||
np.asarray([2], dtype=np.int32),
|
||||
np.asarray([1], dtype=np.int32),
|
||||
np.asarray([1.0], dtype=np.float32),
|
||||
np.asarray([1.0], dtype=np.float32),
|
||||
np.zeros(input_features.shape).astype(np.int32))
|
||||
generated_ids = ort_outputs[0]
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче