huggingface / huggingface/transformers.js

[Bug] Cannot get transformer working in electron browser

Open
#410 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
16.3k
Forks
1.2k
Avg merge
6d 2h
Merged PRs (30d)
6

Description

**Describe the bug**
*A clear and concise description of what the bug is.*

as described in the title

After debugging into the code, I found that the wrong runtime was selected which caused an `undefined` env property. This bug was also mentioned in issue #336.

https://github.com/xenova/transformers.js/blob/768a2e26d7f34746caa2b102f55dbd270c5d6f36/src/backends/onnx.js#L32

**How to reproduce**
*Steps or a minimal working example to reproduce the behavior*

**Expected behavior**
*A clear and concise description of what you expected to happen.*

**Logs/screenshots**
*If applicable, add logs/screenshots to help explain your problem.*

```
[transformerjs cannot electron browser
](env.js:60 Uncaught TypeError: Cannot read properties of undefined (reading 'wasm'))
```

**Environment**
- Transformers.js version:
- Browser (if applicable):
- Operating system (if applicable):
- Other:

**Additional context**
*Add any other context about the problem here.*

I removed the runtime env check condition in my local and then the transformer worked fine.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.