Skip to content
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

Unsupported dtype in weight 'unknown_147': float16 #5847

Closed
josephrocca opened this issue Nov 15, 2021 · 2 comments · Fixed by #5858
Closed

Unsupported dtype in weight 'unknown_147': float16 #5847

josephrocca opened this issue Nov 15, 2021 · 2 comments · Fixed by #5858
Assignees
Labels
type:bug Something isn't working

Comments

@josephrocca
Copy link
Contributor

josephrocca commented Nov 15, 2021

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 20.04
  • TensorFlow.js installed from (npm or script link): https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@3.11.0/dist/tf.js
  • TensorFlow.js version (use command below): 3.11.0
  • Browser version: Chrome 95
  • Tensorflow.js Converter Version: tensorflowjs 3.11.0; Dependency versions: keras 2.7.0, tensorflow 2.7.0

Describe the current behavior
I'm trying to port OpenAI's CLIP model to tfjs, and I've used the following conversion command:

!tensorflowjs_converter --input_format tf_saved_model ./clip-text-vit-32-tf ./clip-text-vit-32-tfjs

Here's the TF Saved Model that I'm trying to convert. When running the model with tfjs I get this error:

image

Describe the expected behavior
If it's due to float16 not being supported, then I'd have expected tensorflowjs_converter to either automatically convert the float16 values to float32 like it seems to do with other unsupported datatypes, or throw an error telling me that this model cannot be converted into a tfjs model.

Standalone code to reproduce the issue

  1. Download this HTML file: https://github.com/josephrocca/openai-clip-js/blob/main/tfjs-text-demo.html
  2. Download the tfjs model files from this Google Drive link (or generate them using the above-linked Saved Model + the tensorflowjs_converter command). Ensure the folder is named clip-text-vit-32-tfjs.
  3. Put the tfjs model folder in the same directory as the HTML file and run a static file server (e.g. deno run --allow-net --allow-read=. https://raw.githubusercontent.com/josephrocca/denoSimpleStatic/master/main.ts --port=3001)
@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@nrathi
Copy link

nrathi commented Oct 16, 2023

Hey @josephrocca, would you happen to have updated code? I'm having trouble figuring out how to use OpenAI CLIP via TensorFlow JS. Thank you!

Edit: I found this: https://colab.research.google.com/github/josephrocca/openai-clip-js/blob/main/Export_CLIP_to_ONNX_tflite_tfjs_tf_saved_model.ipynb#scrollTo=0BpdJkdBssk9

But it's a bit out of date so I'm trying to figure out what versions to install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants