Closed ramarnat closed 1 year ago
Ok I didn't check the obvious thing - whether the rust_model.ot file was created and exists. It does not but the convert_model step did not fail. One of the failures during testing yesterday was that the convert failed because libtorch_cpu.so was missing ABI symbols causing the convert to fail, which is why I built libtorch from scratch. That didn't show up as an error after the build, so I didn't think to check the ot
file.
Anyway I am rechecking that step now to see what might be causing that behavior and will report back shortly.
This now works, my updated docker section:
ENV CARGO_HOME=/opt/cargo
ENV PATH=/opt/cargo/bin:$PATH
RUN git -C resources clone https://huggingface.co/sentence-transformers/multi-qa-MiniLM-L6-cos-v1 && \
rm -rf resources/multi-qa-MiniLM-L6-cos-v1/.git
RUN git clone https://github.com/guillaume-be/rust-bert.git && \
cd rust-bert && \
pip3 install --no-cache-dir -r requirements.txt
# 1. convert the model to rust
# 2. Make sure the rust model was created
# 3. remove the python models to save space
RUN python3 rust-bert/utils/convert_model.py resources/multi-qa-MiniLM-L6-cos-v1/pytorch_model.bin && \
[ ! -f resources/multi-qa-MiniLM-L6-cos-v1/rust_model.ot ] && exit 1 || \
rm resources/multi-qa-MiniLM-L6-cos-v1/model.npz && \
rm resources/multi-qa-MiniLM-L6-cos-v1/pytorch_model.bin && \
rm resources/multi-qa-MiniLM-L6-cos-v1/tf_model.h5
I guess my only request would be to see if convert_model.py, could fail out if convert_tensor fails.
This is what I have been looking fore , thank you!
For some reason I am unable to load a sentence transformer model in docker, this works fine running it directly on my mac m2, but does not work in a docker container. I initially thought it was the libtorch installation, but the same issue persists even if libtorch is built from scratch. The issue happens on an intel mac running docker as well.
Hopefully I have provided enough here to see or recreate the issue - maybe it's something obvious, if not I can create a repo. Any ideas or thoughts would be appreciated.
On the mac it works as expected:
main.rs
Cargo.toml
Dockerfile
The failure