Git Product home page Git Product logo

Comments (7)

customautosys avatar customautosys commented on May 27, 2024 1

Hi @xenova, sorry to have bothered you. I solved this problem by upgrading @quasar/app-vite to ^2.0.0-beta.12 and vite to ^5.2.10.

Thanks anyway!

from transformers.js.

bekatan avatar bekatan commented on May 27, 2024

I had the same issue. adding
import { nodePolyfills } from "vite-plugin-node-polyfills";
export default defineConfig((configEnv) => ({ plugins: [ nodePolyfills({ exclude: ["stream"] }), ], }));
to vite.config.ts seems to have resolved it.
But now I get
image
My code is from the sentiment-analysis pipelines API docs
image
I have a vanilla typescript 5.4.3, with vite/5.2.2 win32-x64 node-v22.1.0 project

from transformers.js.

xenova avatar xenova commented on May 27, 2024

I think I should be able to just remote that import (since we don't support node < 18 anymore).

from transformers.js.

xenova avatar xenova commented on May 27, 2024

#752 should fix this.

from transformers.js.

customautosys avatar customautosys commented on May 27, 2024

Hi I'm having a problem when importing @xenova/transformers in vite. Basically it's trying to import onnxruntime-node and sharp, which are not supposed to be imported as they are native modules, and this is causing all sorts of errors. I have also tried to ask here: vitejs/vite#10314 (comment)

I've tried adding vite-plugin-node-polyfills and have removed it as it did not seem to help the errors.

@bekatan and @jzyzxx, do you know how to get @xenova/transformers working in a vite project?

from transformers.js.

xenova avatar xenova commented on May 27, 2024

@customautosys The default vite settings should be able to ignore these by looking at the package.json's browser field. Could you provide more information about your environment?

See here for an example: https://github.com/xenova/transformers.js/tree/main/examples/depth-anything-client

from transformers.js.

customautosys avatar customautosys commented on May 27, 2024

@customautosys The default vite settings should be able to ignore these by looking at the package.json's browser field. Could you provide more information about your environment?

See here for an example: https://github.com/xenova/transformers.js/tree/main/examples/depth-anything-client

I am using https://github.com/quasarframework/quasar

I asked them and they said the cache for the node_modules is built by Vite and it's not something Quasar does.

I don't know why Vite seems to be ignoring the browser field. I've tried Vite versions 3, 4 and 5 and nothing works. I couldn't find anything in the Vite documentation about any flag controlling whether the browser field is ignored.

from transformers.js.

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.