unable to import weights.bin into react native using vscode

531 Views Asked by At

I'm trying to implement a model using TensorFlowJS, I took an existing h5 model, and transferred it to json and weights using tensorflowjs_wizard, I'm now trying to import both files so I can use them, but my VS code does not recognize the weights file, even when I try to get the location by hand, it won't recognize the file enter image description here

anyone knows a solution?

1

There are 1 best solutions below

0
On

I found the answer, in the root folder you need to create a metro.config.js file and add this:

const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
  resolver: {
    assetExts: ['bin', 'txt', 'jpg', 'ttf', 'png'],
    sourceExts: ['js', 'json', 'ts', 'tsx', 'jsx'],
    blacklistRE: blacklist([/platform_node/])
  },
};