GithubHelp home page GithubHelp logo

When Attempting to loadSavedModel, I Encountered 'java.lang.Exception: Could Not Retrieve the SavedModelBundle + () about spark-nlp HOT 16 OPEN

TerryLaw535 avatar TerryLaw535 commented on May 26, 2024
When Attempting to loadSavedModel, I Encountered 'java.lang.Exception: Could Not Retrieve the SavedModelBundle + ()

from spark-nlp.

Comments (16)

Alexwangziyu avatar Alexwangziyu commented on May 26, 2024 1

Hi @TerryLaw535

To import T5 models (fine-tuned or already on HF) you can use one of these 2 notebooks:

Depending on which one you have saved (exported) your T5 model, you can follow the instructions to import your model into Spark NLP. (I personally recommend first trying ONNX, it has a faster inference time)

hi maziyarpanahi, thanks for your resource, however, I tried different transformers, tensorflow versions but none of them worked, basically there are all kinds of errors. And the code doesn't work on colab correctly either. Could you please check it out? Thank you so much!

from spark-nlp.

maziyarpanahi avatar maziyarpanahi commented on May 26, 2024

Hi @TerryLaw535

To import T5 models (fine-tuned or already on HF) you can use one of these 2 notebooks:

Depending on which one you have saved (exported) your T5 model, you can follow the instructions to import your model into Spark NLP. (I personally recommend first trying ONNX, it has a faster inference time)

from spark-nlp.

TerryLaw535 avatar TerryLaw535 commented on May 26, 2024

Hi @maziyarpanahi

Thank you so much for your reply. I tried ONNX and it showed that [ONNXRuntimeError] : 1 : FAIL : Loading the model from onnx_models/google-t5/t5-small/decoder_model_merged.onnx failed:/onnxruntime_src/onnxruntime/core/graph/model.cc:179 onnxruntime::Model::Model(onnx::ModelProto&&, the onnxruntime::PathString&, the onnxruntime::IOnnxRuntimeOpSchemaRegistryList*, the onnxruntime::logging::Logger&, the onnxruntime::ModelOptions&) Unsupported model IR version: 10, max supported IR version: 9.

I also tried the TensorFlow method. I completely followed the instructions except for setting tensorflow == 2.8, since this version is too old and no longer available. I tried the code:
try:
model = T5ExportModel.from_pretrained(MODEL_NAME)
except:
model = T5ExportModel.from_pretrained(MODEL_NAME, from_pt=True)

model.export(EXPORT_PATH, use_cache=True)

and it report:
TypeError: in user code:

File "/tmp/ipykernel_70993/430537825.py", line 50, in decoder_init_serving  *
    logits = self.shared(sequence_output, mode="linear")
File "/home/weichengyu/.local/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler  **
    raise e.with_traceback(filtered_tb) from None

TypeError: Embedding.call() got an unexpected keyword argument 'mode'

Do you know how to deal with these problems? I think these problems are all related to version issues.

Thank you!

from spark-nlp.

maziyarpanahi avatar maziyarpanahi commented on May 26, 2024

Hi @Alexwangziyu

I will assign someone to have a look at the TensorFlow to Spark NLP, something might have changed in Hugging Face. For the T5, I will ask someone to make a quick test to see if the notebooks are up to date.

from spark-nlp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.