INF-WSE
is a series of word-level sparse embedding models developed by
INFLY TECH
.
These models are optimized to generate sparse, high-dimensional text embeddings that excel in capturing the most
relevant information for search and retrieval, particularly in Chinese text.
Key Features:
Optimized for Retrieval
: INF-WSE is designed with retrieval tasks in mind. The sparse embeddings enable efficient
matching between queries and documents, making it highly effective for semantic search, ranking, and information
retrieval scenarios where speed and accuracy are critical.
Word-level Sparse Embeddings
: The model generates sparse representations at the word level, capturing essential
semantic details that help improve the relevance of search results. This is particularly useful for Chinese language
retrieval tasks, where word segmentation can significantly impact performance.
Sparse Representation for Efficiency
: Unlike dense embeddings that have a fixed number of dimensions, INF-WSE
produces sparse embeddings where the dimensionality matches the vocabulary size. Most dimensions are set to zero,
focusing only on the most significant terms. This sparsity reduces the computational load, enabling faster retrieval
without compromising on precision.
Usage
Transformers
Infer Embeddings
import torch
from transformers import AutoTokenizer, AutoModel
queries = ['电脑一体机由什么构成?', '什么是掌上电脑?']
documents = [
'电脑一体机,是由一台显示器、一个电脑键盘和一个鼠标组成的电脑。',
'掌上电脑是一种运行在嵌入式操作系统和内嵌式应用软件之上的、小巧、轻便、易带、实用、价廉的手持式计算设备。',
]
input_texts = queries + documents
tokenizer = AutoTokenizer.from_pretrained("infly/inf-wse-v1-base-zh", trust_remote_code=True, use_fast=False) # Fast tokenizer has not been supported yet
model = AutoModel.from_pretrained("infly/inf-wse-v1-base-zh", trust_remote_code=True)
model.eval()
max_length = 512
input_batch = tokenizer(input_texts, padding=True, max_length=max_length, truncation=True, return_tensors="pt")
with torch.no_grad():
embeddings = model(input_batch['input_ids'], input_batch['attention_mask'], return_sparse=False) # if return_sparse=True, return sparse tensor, else return dense tensor
scores = embeddings[:2] @ embeddings[2:].T
print(scores.tolist())
# [[21.224790573120117, 4.520412921905518], [10.290857315063477, 19.359437942504883]]
Runs of infly inf-wse-v1-base-zh on huggingface.co
36
Total runs
0
24-hour runs
0
3-day runs
-20
7-day runs
-103
30-day runs
More Information About inf-wse-v1-base-zh huggingface.co Model
inf-wse-v1-base-zh huggingface.co
inf-wse-v1-base-zh huggingface.co is an AI model on huggingface.co that provides inf-wse-v1-base-zh's model effect (), which can be used instantly with this infly inf-wse-v1-base-zh model. huggingface.co supports a free trial of the inf-wse-v1-base-zh model, and also provides paid use of the inf-wse-v1-base-zh. Support call inf-wse-v1-base-zh model through api, including Node.js, Python, http.
inf-wse-v1-base-zh huggingface.co is an online trial and call api platform, which integrates inf-wse-v1-base-zh's modeling effects, including api services, and provides a free online trial of inf-wse-v1-base-zh, you can try inf-wse-v1-base-zh online for free by clicking the link below.
infly inf-wse-v1-base-zh online free url in huggingface.co:
inf-wse-v1-base-zh is an open source model from GitHub that offers a free installation service, and any user can find inf-wse-v1-base-zh on GitHub to install. At the same time, huggingface.co provides the effect of inf-wse-v1-base-zh install, users can directly use inf-wse-v1-base-zh installed effect in huggingface.co for debugging and trial. It also supports api for free installation.