# from transformers import AutoTokenizer
model_name = "michaelfeil/ct2fast-all-MiniLM-L12-v2"
model_name_orig="sentence-transformers/all-MiniLM-L12-v2"from hf_hub_ctranslate2 import EncoderCT2fromHfHub
model = EncoderCT2fromHfHub(
# load in int8 on CUDA
model_name_or_path=model_name,
device="cuda",
compute_type="int8_float16"
)
outputs = model.generate(
text=["I like soccer", "I like tennis", "The eiffel tower is in Paris"],
max_length=64,
) # perform downstream tasks on outputs
outputs["pooler_output"]
outputs["last_hidden_state"]
outputs["attention_mask"]
# alternative, use SentenceTransformer Mix-In# for end-to-end Sentence embeddings generation# (not pulling from this CT2fast-HF repo)from hf_hub_ctranslate2 import CT2SentenceTransformer
model = CT2SentenceTransformer(
model_name_orig, compute_type="int8_float16", device="cuda"
)
embeddings = model.encode(
["I like soccer", "I like tennis", "The eiffel tower is in Paris"],
batch_size=32,
convert_to_numpy=True,
normalize_embeddings=True,
)
print(embeddings.shape, embeddings)
scores = (embeddings @ embeddings.T) * 100# Hint: you can also host this code via REST API and# via github.com/michaelfeil/infinity
This is just a quantized version. Licence conditions are intended to be idential to original huggingface repo.
Original description
Runs of michaelfeil ct2fast-all-MiniLM-L12-v2 on huggingface.co
4
Total runs
-2
24-hour runs
-2
3-day runs
-2
7-day runs
-1
30-day runs
More Information About ct2fast-all-MiniLM-L12-v2 huggingface.co Model
ct2fast-all-MiniLM-L12-v2 huggingface.co
ct2fast-all-MiniLM-L12-v2 huggingface.co is an AI model on huggingface.co that provides ct2fast-all-MiniLM-L12-v2's model effect (), which can be used instantly with this michaelfeil ct2fast-all-MiniLM-L12-v2 model. huggingface.co supports a free trial of the ct2fast-all-MiniLM-L12-v2 model, and also provides paid use of the ct2fast-all-MiniLM-L12-v2. Support call ct2fast-all-MiniLM-L12-v2 model through api, including Node.js, Python, http.
ct2fast-all-MiniLM-L12-v2 huggingface.co is an online trial and call api platform, which integrates ct2fast-all-MiniLM-L12-v2's modeling effects, including api services, and provides a free online trial of ct2fast-all-MiniLM-L12-v2, you can try ct2fast-all-MiniLM-L12-v2 online for free by clicking the link below.
michaelfeil ct2fast-all-MiniLM-L12-v2 online free url in huggingface.co:
ct2fast-all-MiniLM-L12-v2 is an open source model from GitHub that offers a free installation service, and any user can find ct2fast-all-MiniLM-L12-v2 on GitHub to install. At the same time, huggingface.co provides the effect of ct2fast-all-MiniLM-L12-v2 install, users can directly use ct2fast-all-MiniLM-L12-v2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
ct2fast-all-MiniLM-L12-v2 install url in huggingface.co: