huggingface / huggingface/transformers.js

Using a server backend to generate masks - doublelotus

Open
#585 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
16.3k
Forks
1.2k
Avg merge
6d 2h
Merged PRs (30d)
6

Description

### Question

Hi there, just continuing on from my question on - https://huggingface.co/posts/Xenova/240458016943176#65ca9d9c8e0d94e48742fad7.

I've just been reading through your response and initially I was trying it using a python backend and attempted to mimic the worekr.js code like so:

```py
from transformers import SamModel, SamProcessor, AutoProcessor
import numpy as np

model = SamModel.from_pretrained("Xenova/sam-vit-large")
processor = AutoProcessor.from_pretrained("Xenova/sam-vit-large")
```
but was running into this error (as I'm assuming that model isn't supported for a python backend
OSError: Xenova/sam-vit-large does not appear to have a file named pytorch_model.bin, tf_model.h5, model.ckpt or flax_model.msgpack.

The main reason behind trying this is because when I tried with sam-vit-base on the web app it was quite slow in generating the image embeddings, would using a node.js server to do that with the onnx server as you suggested be much faster or is there a better way to achieve that?

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.