EricLBuehler / mistral.rs

Blazingly fast LLM inference.
MIT License
3.41k stars 247 forks source link

Mistral rs python binding error #323

Closed shresht8 closed 2 months ago

shresht8 commented 4 months ago

Bug:

I am attempting to run mistral rs for inference for my own GGUF files but before that I wanted to test with the example given in the documentation. I installed mistral rs using ubuntu 22.04 since I have a windows machine with RTX 4070 GPU. I installed the dependencies required as well using ubuntu such as the libssl-dev and pkg-config. Once that was done I went into my conda environment and ran the pip install mistralrs-cuda command to install the package. It ran successfully without any errors so I assumed the installation was complete. Is there any verification process for the installation? Once the installation was complete, I successfully imported the packages and then attempted to run the example given in the documentation given for the python bindings:

runner = Runner( which=Which.GGUF( tok_model_id="mistralai/Mistral-7B-Instruct-v0.1", quantized_model_id="TheBloke/Mistral-7B-Instruct-v0.1-GGUF", quantized_filename="mistral-7b-instruct-v0.1.Q4_K_M.gguf", tokenizer_json=None, repeat_last_n=64, ) )

and got the below error:

PanicException Traceback (most recent call last) Cell In[2], line 1 ----> 1 runner = Runner( 2 which=Which.GGUF( 3 tok_model_id="mistralai/Mistral-7B-Instruct-v0.1", 4 quantized_model_id="TheBloke/Mistral-7B-Instruct-v0.1-GGUF", 5 quantized_filename="mistral-7b-instruct-v0.1.Q4_K_M.gguf", 6 tokenizer_json=None, 7 repeat_last_n=64, 8 ) 9 )

PanicException: called Result::unwrap() on an Err value: LoadLibraryExW { source: Os { code: 126, kind: Uncategorized, message: "The specified module could not be found." } }

I attempted to run the actual mistral model as well (not the GGUF version) like this: runner = Runner( which=Which.Plain( model_id="mistralai/Mistral-7B-Instruct-v0.1", arch=Architecture.Mistral, tokenizer_json=None, repeat_last_n=64, ) )

But I got the same error as above. Can anyone help me understand the cause of this error?

Latest commit commit 455653c59884e79f471cf910c5fd6daea7f5beca (HEAD -> master, origin/master, origin/HEAD)

EricLBuehler commented 4 months ago

Thank you for reporting this.

Can you please try to run an example from the command line, for example the below, which loads a GGUF model as configurable in the .toml file here:

./mistralrs_server --port 1234 toml -f toml-selectors/gguf.toml

I think that if this works, we can isolate the issue with the Python bindings and not a general issue.


It ran successfully without any errors so I assumed the installation was complete. Is there any verification process for the installation?

You can run import mistralrs. However, if the pip installation succeeds, I think it worked, especially given that you were able to import the packages.

shresht8 commented 4 months ago

Thank you for your response.

I tried running: .\mistralrs_server --port 1234 toml -f toml-selectors/gguf.toml from the environment command line where mistral rs is installed

But I get the below error:

.\mistralrs_server : The term '.\mistralrs_server' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

I am guessing I am either not running it from the right directory or I need to add something to PATH before running it. Can you tell me where I must run you

EricLBuehler commented 4 months ago

Ok, sorry I wasn't more clear. If you go to the mistral.rs directory (not mistralrs-pyo3), and run the following, does it work?

cargo run --release --features cuda -- -i  toml -f toml-selectors/gguf.toml
shresht8 commented 4 months ago

I was able to run the command. I got an error, this is my logs from running the command :

cargo run --release --features cuda -- -i toml -f toml-selectors/gguf.toml

Updating crates.io index Updating git repository https://github.com/EricLBuehler/candle.git Updating git submodule https://github.com/NVIDIA/cutlass.git
Updating git repository https://github.com/EricLBuehler/range-checked.git
Updating git repository https://github.com/EricLBuehler/candle-layer-norm.git
Downloaded block-buffer v0.10.4
Downloaded crypto-common v0.1.6
Downloaded cli-table v0.4.7
Downloaded cli-table-derive v0.4.5
Downloaded http-body v1.0.0
Downloaded rust-embed-utils v8.4.0
Downloaded sync_wrapper v1.0.1 Downloaded tower-service v0.3.2
Downloaded tower-layer v0.3.2 Downloaded generic-array v0.14.7
Downloaded mime v0.3.17
Downloaded thiserror-impl v1.0.61 Downloaded unicase v2.7.0
Downloaded serde_spanned v0.6.6
Downloaded proc-macro-error v1.0.4
Downloaded pin-project-internal v1.1.5
Downloaded typenum v1.17.0 Downloaded utoipa v4.2.3
Downloaded zip v0.6.6
Downloaded http v1.1.0
Downloaded tower v0.4.13
Downloaded utoipa-gen v4.3.0
Downloaded syn v2.0.64
Downloaded rustls-webpki v0.102.4
Downloaded tower-http v0.5.2
Downloaded libc v0.2.155
Downloaded rust-embed v8.4.0
Downloaded zip v1.3.0
Downloaded dyn-fmt v0.4.0
Downloaded csv v1.3.0
Downloaded pulp v0.18.12
Downloaded hyper v1.3.1
Downloaded axum v0.7.5
Downloaded toml_edit v0.22.13
Downloaded serde v1.0.202
Downloaded toml v0.8.13
Downloaded hyper-util v0.1.3
Downloaded sha2 v0.10.8
Downloaded serde_derive v1.0.202 Downloaded pin-project v1.1.5
Downloaded miniz_oxide v0.7.3
Downloaded matchit v0.7.3 Downloaded mime_guess v2.0.4
Downloaded httparse v1.8.0
Downloaded csv-core v0.1.11
Downloaded toml_datetime v0.6.6 Downloaded thiserror v1.0.61
Downloaded termcolor v1.4.1
Downloaded utoipa-swagger-ui v6.0.0 Downloaded serde_urlencoded v0.7.1
Downloaded serde_path_to_error v0.1.16
Downloaded rustversion v1.0.17 Downloaded proc-macro-error-attr v1.0.4
Downloaded httpdate v1.0.3 Downloaded http-body-util v0.1.1
Downloaded either v1.12.0
Downloaded digest v0.10.7 Downloaded cpufeatures v0.2.12
Downloaded axum-core v0.4.3
Downloaded rust-embed-impl v8.4.0
Downloaded sync_wrapper v0.1.2 Downloaded anyhow v1.0.86 Downloaded 62 crates (9.6 MB) in 2.79s (largest was utoipa-swagger-ui at 4.4 MB)
Compiling proc-macro2 v1.0.82 Compiling unicode-ident v1.0.12 Compiling cfg-if v1.0.0 Compiling autocfg v1.3.0 Compiling windows_x86_64_msvc v0.52.5 Compiling version_check v0.9.4 Compiling serde v1.0.202 Compiling once_cell v1.19.0 Compiling crossbeam-utils v0.8.19 Compiling libm v0.2.8 Compiling rayon-core v1.12.1 Compiling cc v1.0.97 Compiling itoa v1.0.11 Compiling memchr v2.7.2 Compiling ppv-lite86 v0.2.17 Compiling typenum v1.17.0 Compiling smallvec v1.13.2 Compiling crc32fast v1.4.0 Compiling bitflags v1.3.2 Compiling pin-project-lite v0.2.14 Compiling paste v1.0.15 Compiling windows_x86_64_msvc v0.48.5 Compiling zerocopy v0.7.34 Compiling getrandom v0.2.15
Compiling allocator-api2 v0.2.18
Compiling syn v1.0.109
Compiling equivalent v1.0.1
Compiling target-lexicon v0.12.14
Compiling serde_json v1.0.117
Compiling generic-array v0.14.7
Compiling rand_core v0.6.4
Compiling num-traits v0.2.19 Compiling ahash v0.8.11
Compiling lock_api v0.4.12
Compiling regex-syntax v0.8.3
Compiling rand_chacha v0.3.1
Compiling ryu v1.0.18 Compiling parking_lot_core v0.9.10
Compiling reborrow v0.5.5
Compiling aho-corasick v1.1.3
Compiling log v0.4.21
Compiling bytes v1.6.0
Compiling futures-core v0.3.30
Compiling scopeguard v1.2.0
Compiling rand v0.8.5
Compiling slab v0.4.9
Compiling raw-cpuid v10.7.0
Compiling seq-macro v0.3.5
Compiling num_cpus v1.16.0
Compiling either v1.12.0
Compiling windows-targets v0.52.5
Compiling regex-automata v0.4.6
Compiling fnv v1.0.7
Compiling crossbeam-epoch v0.9.18
Compiling futures-sink v0.3.30 Compiling quote v1.0.36
Compiling windows-targets v0.48.5
Compiling futures-io v0.3.30
Compiling pin-utils v0.1.0
Compiling futures-task v0.3.30
Compiling windows-sys v0.52.0
Compiling thiserror v1.0.61
Compiling semver v1.0.23
Compiling futures-channel v0.3.30
Compiling crossbeam-deque v0.8.5
Compiling pyo3-build-config v0.21.2
Compiling siphasher v0.3.11
Compiling syn v2.0.64
Compiling rand_distr v0.4.3
Compiling windows-sys v0.48.0
Compiling hashbrown v0.14.5
Compiling regex v1.10.4 Compiling libc v0.2.155
Compiling backtrace v0.3.71
Compiling parking_lot v0.12.2
Compiling phf_shared v0.11.2
Compiling tracing-core v0.1.32
Compiling glob v0.3.1
Compiling lazy_static v1.4.0
Compiling rustversion v1.0.17
Compiling http v1.1.0
Compiling ring v0.17.8
Compiling rayon v1.10.0
Compiling unicase v2.7.0
Compiling ident_case v1.0.1
Compiling mio v0.8.11
Compiling synstructure v0.13.1
Compiling percent-encoding v2.3.1
Compiling socket2 v0.5.7
Compiling anyhow v1.0.86
Compiling winapi v0.3.9
Compiling rustc-demangle v0.1.24
Compiling strsim v0.10.0
Compiling rustc_version v0.4.0
Compiling zip v1.3.0
Compiling phf_generator v0.11.2
Compiling cudarc v0.11.1 Compiling darling_core v0.14.4
Compiling form_urlencoded v1.2.1
Compiling http-body v1.0.0
Compiling portable-atomic v1.6.0
Compiling stable_deref_trait v1.2.0
Compiling tinyvec_macros v0.1.1
Compiling vob v3.0.3
Compiling winapi-util v0.1.8
Compiling phf_codegen v0.11.2
Compiling block-buffer v0.10.4
Compiling crypto-common v0.1.6
Compiling phf v0.11.2
Compiling bindgen_cuda v0.1.5
Compiling serde_derive v1.0.202
Compiling bytemuck_derive v1.6.0
Compiling futures-macro v0.3.30
Compiling thiserror-impl v1.0.61
Compiling tokio-macros v2.2.0
Compiling tracing-attributes v0.1.27
Compiling zerofrom-derive v0.1.3
Compiling tinyvec v1.6.0
Compiling displaydoc v0.2.4
Compiling yoke-derive v0.7.3
Compiling parse-zoneinfo v0.3.1
Compiling libloading v0.8.3
Compiling proc-macro-error-attr v1.0.4
Compiling anstyle v1.0.7
Compiling utf8parse v0.2.1
Compiling darling_macro v0.14.4
Compiling rustls-pki-types v1.7.0
Compiling candle-kernels v0.5.1 (https://github.com/EricLBuehler/candle.git#9b151f51) Compiling adler v1.0.2
Compiling httparse v1.8.0
Compiling pkg-config v0.3.30
Compiling tokio v1.37.0 Compiling untrusted v0.9.0
Compiling spin v0.9.8
Compiling candle-layer-norm v0.0.1 (https://github.com/EricLBuehler/candle-layer-norm.git#8001f04b) Compiling chrono-tz-build v0.2.1
Compiling miniz_oxide v0.7.3 Compiling futures-util v0.3.30
Compiling darling v0.14.4
Compiling unicode-normalization v0.1.23
Compiling anstyle-wincon v3.0.3
Compiling bytemuck v1.16.0
Compiling anstyle-parse v0.2.4
Compiling onig_sys v69.8.1
Compiling digest v0.10.7
Compiling tracing v0.1.40
Compiling same-file v1.0.6
Compiling memmap2 v0.9.4
Compiling pyo3-ffi v0.21.2 Compiling num-complex v0.4.6
Compiling half v2.4.1
Compiling dyn-stack v0.10.0 Compiling anstyle-query v1.0.3
Compiling proc-macro-error v1.0.4
Compiling colorchoice v1.0.1
Compiling cpufeatures v0.2.12
Compiling native-tls v0.2.11
Compiling rustls v0.22.4
Compiling is_terminal_polyfill v1.70.0
Compiling byteorder v1.5.0
Compiling pulp v0.18.12
Compiling tower-service v0.3.2
Compiling unicode-bidi v0.3.15
Compiling encode_unicode v0.3.6
Compiling tower-layer v0.3.2 Compiling unicode-width v0.1.12
Compiling anstream v0.6.14
Compiling sha2 v0.10.8
Compiling idna v0.5.0
Compiling zerofrom v0.1.3
Compiling console v0.15.8
Compiling walkdir v2.5.0
Compiling rustls-webpki v0.102.4 Compiling flate2 v1.0.30
Compiling derive_builder_core v0.12.0
Compiling chrono-tz v0.8.6
Compiling axum-core v0.4.3
Compiling pin-project-internal v1.1.5
Compiling async-trait v0.1.80 Compiling http-body-util v0.1.1
Compiling yoke v0.7.3
Compiling schannel v0.1.23
Compiling esaxx-rs v0.1.10
Compiling memoffset v0.9.1
Compiling mime v0.3.17
Compiling indexmap v2.2.6
Compiling strsim v0.11.1
Compiling minimal-lexical v0.2.1
Compiling zeroize v1.7.0
Compiling rust_decimal v1.35.0
Compiling heck v0.4.1
Compiling heck v0.5.0 Compiling httpdate v1.0.3
Compiling option-ext v0.2.0
Compiling bit-vec v0.6.3
Compiling number_prefix v0.4.0
Compiling clap_lex v0.7.0 Compiling eyre v0.6.12
Compiling subtle v2.5.0
Compiling clap_derive v4.5.4
Compiling bit-set v0.5.3
Compiling clap_builder v4.5.2
Compiling derive_builder_macro v0.12.0
Compiling hyper v1.3.1
Compiling safetensors v0.4.3
Compiling dirs-sys v0.4.1 Compiling pin-project v1.1.5
Compiling pyo3-macros-backend v0.21.2
Compiling nom v7.1.3
Compiling zip v0.6.6
Compiling itertools v0.11.0
Compiling toml_datetime v0.6.6
Compiling gemm-common v0.17.1
Compiling indicatif v0.17.8
Compiling serde_spanned v0.6.6
Compiling packedvec v1.2.4
Compiling rust-embed-utils v8.4.0
Compiling url v2.5.0
Compiling mime_guess v2.0.4
Compiling crossterm_winapi v0.9.1
Compiling webpki-roots v0.26.1
Compiling axum v0.7.5 Compiling gemm-f32 v0.17.1
Compiling gemm-c32 v0.17.1
Compiling gemm-c64 v0.17.1
Compiling gemm-f64 v0.17.1
Compiling monostate-impl v0.1.13
Compiling gemm-f16 v0.17.1
Compiling pyo3 v0.21.2
Compiling num-integer v0.1.46
Compiling chrono v0.4.38
Compiling winnow v0.6.8
Compiling base64 v0.13.1
Compiling regex-syntax v0.6.29
Compiling arrayvec v0.7.4
Compiling indenter v0.3.3
Compiling gemm v0.17.1
Compiling macro_rules_attribute-proc_macro v0.2.0
Compiling unicode-segmentation v1.11.0
Compiling base64 v0.22.1 Compiling sync_wrapper v0.1.2 Compiling ureq v2.9.7
Compiling macro_rules_attribute v0.2.0
Compiling spm_precompiled v0.1.4
Compiling onig v6.4.0
Compiling pyo3-macros v0.21.2
Compiling regex-automata v0.1.10
Compiling toml_edit v0.22.13
Compiling num-bigint v0.4.5
Compiling monostate v0.1.13
Compiling crossterm v0.25.0
Compiling utoipa-gen v4.3.0
Compiling rayon-cond v0.3.0
Compiling rust-embed-impl v8.4.0
Compiling sparsevec v0.2.0
Compiling clap v4.5.4
Compiling utoipa-swagger-ui v6.0.0
Compiling tower v0.4.13
Compiling hyper-util v0.1.3
Compiling dirs v5.0.1
Compiling derive_builder v0.12.0
Compiling fancy-regex v0.13.0
Compiling cfgrammar v0.13.5
Compiling itertools v0.12.1
Compiling serde_urlencoded v0.7.1
Compiling serde_plain v1.0.2
Compiling serde_path_to_error v0.1.16
Compiling futures-executor v0.3.30
Compiling unicode-normalization-alignments v0.1.12
Compiling nibble_vec v0.1.0
Compiling overload v0.1.1
Compiling defmac v0.1.3
Compiling matchit v0.7.3 Compiling unindent v0.2.3
Compiling indoc v2.0.5
Compiling sync_wrapper v1.0.1
Compiling endian-type v0.1.2
Compiling unicode_categories v0.1.1
Compiling unchecked-index v0.2.2
Compiling radix_trie v0.2.1
Compiling galil-seiferas v0.1.5
Compiling rustc-hash v1.1.0 Compiling ctrlc v3.4.4 Compiling tracing-subscriber v0.3.18 Compiling dyn-fmt v0.4.0 Compiling tower-http v0.5.2 Compiling utoipa v4.2.3 Compiling candle-core v0.5.1 (https://github.com/EricLBuehler/candle.git#9b151f51) Compiling candle-nn v0.5.1 (https://github.com/EricLBuehler/candle.git#9b151f51) Compiling candle-transformers v0.5.1 (https://github.com/EricLBuehler/candle.git#9b151f51) Compiling mistralrs-core v0.1.8 (C:\Users\shres\Projects\mistral.rs\mistralrs-core) Compiling mistralrs-server v0.1.8 (C:\Users\shres\Projects\mistral.rs\mistralrs-server) Finished release profile [optimized] target(s) in 10m 32s Running target\release\mistralrs-server.exe -i toml -f toml-selectors/gguf.toml thread 'main' panicked at C:\Users\shres.cargo\registry\src\index.crates.io-6f17d22bba15001f\cudarc-0.11.1\src\driver\sys\mod.rs:38:71: called Result::unwrap() on an Err value: LoadLibraryExW { source: Os { code: 126, kind: Uncategorized, message: "The specified module could not be found." } } note: run with RUST_BACKTRACE=1 environment variable to display a backtrace error: process didn't exit successfully: target\release\mistralrs-server.exe -i toml -f toml-selectors/gguf.toml (exit code: 101)

EricLBuehler commented 3 months ago

@shresht8, sorry for the wait. coreylowman/cudarc#240 should fix this, I'll let you know when it gets merged.

EricLBuehler commented 3 months ago

Hi @shresht8, I think it should be fixed now. Can you please try it again after a git pull and cargo update?

EricLBuehler commented 2 months ago

@shresht8 I'll close this issue as I think it should be fixed. Please feel free to reopen!