-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
djl-convert does not produce working model from Huggingface #3518
Comments
@AlEscher The following code works for me for this model:
|
Your error may caused by you set |
@frankfliu Thank you for looking into this!
However just using the built-in translator like in the code snippet you provided seems to work. |
For text embedding case, I really suggest use our built-in If can always create your own translator if you need further customization, if it's an generic use case, please raise an issue or create a PR to improve our build-in I think your error is caused by batch handing. You need return stack batchifier in your
|
@frankfliu I see, thanks!
CodeT5:
The CodeT5 issue seems to be an issue with the model using an unsupported construct |
|
@frankfliu Thank you for fixing this so quickly! |
@frankfliu I just checked
And the generated embeddings also look weird, e.g. they have length pip install "git+https://github.com/deepjavalibrary/djl.git#subdirectory=extensions/tokenizers/src/main/python" Is the |
The recommended way is to use By default, |
|
Description
I am trying to convert a Huggingface model to make it compatible with DJL.
My goal is to use
djl-convert
to convert the model and be able to load it locally.Then I want to generate code-embeddings for Java code, using e.g. Codebert.
I ran
djl-convert -m microsoft/codebert-base -o models/codebert
and then used this code to import the model:The translator is implemented like this:
When generating the embeddings, the model fails with:
What am I doing wrong? Is there a better approach to load a model from huggingface?
codebert-base
does not seem to be available in the Model Zoo.Expected Behavior
The convert tool produces a model that can be loaded locally and has a working
forward
methodError Message
How to Reproduce?
See provided code above
Steps to reproduce
(Paste the commands you ran that produced the error.)
djl-convert
tool as described aboveWhat have you tried to solve it?
I tried many different ways of getting a model from huggingface to work locally, this approach seems to be the intended way according to https://djl.ai/extensions/tokenizers/#convert-huggingface-model-to-torchscript
Environment Info
Please run the command
./gradlew debugEnv
from the root directory of DJL (if necessary, clone DJL first). It will output information about your system, environment, and installation that can help us debug your issue. Paste the output of the command below:The text was updated successfully, but these errors were encountered: