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

Unknown model class "new", attempting to construct from base class. #736

Open
1 of 5 tasks
ksemba opened this issue May 3, 2024 · 1 comment
Open
1 of 5 tasks
Labels
bug Something isn't working

Comments

@ksemba
Copy link

ksemba commented May 3, 2024

System Info

nodejs version: 21.7.2
I'm building a nodejs app, not a web app for the browser. I'm running my app using npx tsx app.ts.

Package.json:
{
"name": "ai-innovation",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest --config jest.config.mjs"
},
"dependencies": {
"@grpc/grpc-js": "^1.10.6",
"@opentelemetry/api": "^1.8.0",
"@opentelemetry/exporter-metrics-otlp-http": "^0.51.0",
"@opentelemetry/exporter-prometheus": "^0.51.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.51.0",
"@opentelemetry/instrumentation-grpc": "^0.51.0",
"@opentelemetry/sdk-metrics": "^1.24.0",
"@opentelemetry/sdk-node": "^0.51.0",
"@opentelemetry/sdk-trace-node": "^1.24.0",
"@supabase/ssr": "^0.3.0",
"@supabase/supabase-js": "^2.42.5",
"@xenova/transformers": "^2.17.1",
"axios": "^1.6.8",
"base64-stream": "^1.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"dotenv": "^16.4.5",
"next": "14.2.2",
"openai": "^4.38.2",
"react": "^18",
"react-dom": "^18",
"reflect-metadata": "^0.2.2",
"winston": "^3.13.0",
"zlib": "^1.0.5"
},
"devDependencies": {
"@swc/core": "^1.3.58",
"@swc/helpers": "^0.5.1",
"@types/base64-stream": "^1.0.5",
"@types/jest": "^29.5.12",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.2",
"jest": "^29.7.0",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tsx": "^4.7.2",
"typescript": "^5"
},
"ts-node": {
"esm": true,
"swc": true
}
}

Environment/Platform

  • Website/web-app
  • Browser extension
  • Server-side (e.g., Node.js, Deno, Bun)
  • Desktop app (e.g., Electron)
  • Other (e.g., VSCode extension)

Description

I copy-pasted the code from here: https://huggingface.co/Alibaba-NLP/gte-large-en-v1.5 for the JavaScript library and ran it locally. It always prints this output:
Unknown model class "new", attempting to construct from base class. Model type for 'new' not found, assuming encoder-only architecture. Please report this at https://github.com/xenova/transformers.js/issues/new/choose.

But it also generates the correct similarities so the code doesn't seem to be broken

Reproduction

  1. Copy transformers.js example code from https://huggingface.co/Alibaba-NLP/gte-large-en-v1.5 into an app.ts file
  2. Run this file using npx tsx app.ts
@ksemba ksemba added the bug Something isn't working label May 3, 2024
@xenova
Copy link
Owner

xenova commented May 8, 2024

Hi there 👋 This is because (for some reason), the model authors decided to choose "new" for the model type in the config.json (see here). Luckily, because it's BERT-like (encoder-only), the model runs correctly since that's selected by the default in transformers.js.

Basically, you can ignore the warning, but thanks for letting us know! :)

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

No branches or pull requests

2 participants