MosRat / MixTex-rs-GUI

GNU General Public License v3.0
6 stars 1 forks source link

问个问题关于ort的。 #2

Closed Esword618 closed 2 weeks ago

Esword618 commented 2 months ago

我在使用ort最新版时报错,不知道为什么,我想询问一下你的ort都设置了什么,比如环境变量什么的。

MosRat commented 2 months ago

设置环境变量ORT_LIB_LOCATION={对应系统的lib},可以看下github actions那里https://github.com/MosRat/MixTex-rs-GUI/blob/53e9f1a461c86b09e2c9203284f07eb15fc02b3a/.github/workflows/release.yml#L119

我是静态链接的,没有用ort给的库

Esword618 commented 2 months ago

你直接下载的微软的嘛?

MosRat commented 2 months ago

项目的从这里获取 https://github.com/MosRat/MixTex-rs-GUI/releases/tag/deps 来源https://github.com/RapidAI/OnnxruntimeBuilder/releases/tag/1.18.1

Esword618 commented 2 months ago

不知道为什么我的出现下面错误: 今天我打算升级到最新的ort rc.5,但是修改后突然报错了,现在回到rc.4: 我的cargo.toml配置: image 运行测试报错,你遇到过吗:

The given version [18] is not supported, only version 1 to 10 is supported in this build.

assertion failed: !api.is_null()
thread 'mixtex::tests::test_interface' panicked at C:\Users\jyj34\.cargo\git\checkouts\ort-675c4f2a84c4db27\04da381\src\lib.rs:214:25:
assertion failed: !api.is_null()
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library\std\src\panicking.rs:652
   1: core::panicking::panic_fmt
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library\core\src\panicking.rs:72
   2: core::panicking::panic
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library\core\src\panicking.rs:146
   3: ort::api::closure$0
             at C:\Users\jyj34\.cargo\git\checkouts\ort-675c4f2a84c4db27\04da381\src\lib.rs:214
   4: std::sync::once_lock::impl$0::get_or_init::closure$0<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,ort::api::closure_env$0>
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\std\src\sync\once_lock.rs:269
   5: std::sync::once_lock::impl$0::initialize::closure$0<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,std::sync::once_lock::impl$0::get_or_init::closure_env$0<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,ort::api::closure_env$0>,never$>
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\std\src\sync\once_lock.rs:476
   6: std::sync::once::impl$2::call_once_force::closure$0<std::sync::once_lock::impl$0::initialize::closure_env$0<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,std::sync::once_lock::impl$0::get_or_init::closure_env$0<core::sync::atomic::AtomicPtr<ort_sys::OrtAp
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\std\src\sync\once.rs:208
   7: std::sys::sync::once::queue::Once::call
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library\std\src\sys\sync\once\queue.rs:183
   8: std::sync::once::Once::call_once_force<std::sync::once_lock::impl$0::initialize::closure_env$0<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,std::sync::once_lock::impl$0::get_or_init::closure_env$0<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,ort::api::
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\std\src\sync\once.rs:208
   9: std::sync::once_lock::OnceLock<core::sync::atomic::AtomicPtr<ort_sys::OrtApi> >::initialize<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,std::sync::once_lock::impl$0::get_or_init::closure_env$0<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,ort::api::clo
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\std\src\sync\once_lock.rs:475
  10: std::sync::once_lock::OnceLock<core::sync::atomic::AtomicPtr<ort_sys::OrtApi> >::get_or_try_init<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,std::sync::once_lock::impl$0::get_or_init::closure_env$0<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,ort::api
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\std\src\sync\once_lock.rs:357
  11: std::sync::once_lock::OnceLock<core::sync::atomic::AtomicPtr<ort_sys::OrtApi> >::get_or_init<core::sync::atomic::AtomicPtr<ort_sys::OrtApi>,ort::api::closure_env$0>
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\std\src\sync\once_lock.rs:269
  12: ort::api
             at C:\Users\jyj34\.cargo\git\checkouts\ort-675c4f2a84c4db27\04da381\src\lib.rs:172
  13: ort::environment::EnvironmentBuilder::commit
             at C:\Users\jyj34\.cargo\git\checkouts\ort-675c4f2a84c4db27\04da381\src\lib.rs:262
  14: pix2text::mixtex::MixTexOnnx::build<std::path::PathBuf,std::path::PathBuf,std::path::PathBuf,std::path::PathBuf>
             at .\src\mixtex.rs:41
  15: pix2text::mixtex::tests::test_interface
             at .\src\mixtex.rs:338
  16: pix2text::mixtex::tests::test_interface::closure$0
             at .\src\mixtex.rs:329
  17: core::ops::function::FnOnce::call_once<pix2text::mixtex::tests::test_interface::closure_env$0,tuple$<> >
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\core\src\ops\function.rs:250
  18: core::ops::function::FnOnce::call_once
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
MosRat commented 2 months ago

我的依赖是这这样:

ort = { version = "2.0.0-rc.4",default-features = false, features = ["ndarray"] }
ndarray = { version = "0.15.6" }

然后你加载的onnx模型是什么?

Esword618 commented 2 months ago

onnx 模型使用的与你的一样

MosRat commented 2 months ago

你的环境变量是怎么设的?RustRover每次测试都要手动设。我这边没问题,我依稀记得看过这个版本不对的问题是链接库版本的问题. image

Esword618 commented 2 months ago

嗷嗷,你这样设置的呀,我是在电脑系统变量里面,我明天像你这样测试一下,刚刚电脑关了,抱歉,你能把你设置这个环境变量发我一下嘛,我明天试一下

MosRat commented 2 months ago

就是那个静态库的位置

项目的从这里获取 https://github.com/MosRat/MixTex-rs-GUI/releases/tag/deps 来源https://github.com/RapidAI/OnnxruntimeBuilder/releases/tag/1.18.1

你下到哪就设置ORT_LIB_LOCATION={有lib文件的文件夹}。RustRover很奇怪,外面的环境变量似乎不认

Esword618 commented 2 months ago

你说的这个问题我遇到过,在使用clion时,我连接wsl,但是无法使用wsl设置的环境变量,需要手动在clion中配置,不知道为什么。