Feature Extraction
sentence-transformers
ONNX
Safetensors
multilingual
bidirectional_pplx_qwen3
sentence-similarity
mteb
custom_code
text-embeddings-inference
Instructions to use perplexity-ai/pplx-embed-v1-0.6b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use perplexity-ai/pplx-embed-v1-0.6b with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("perplexity-ai/pplx-embed-v1-0.6b", trust_remote_code=True) sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Drop cache_position kwarg (removed from create_causal_mask in transformers 5.9)
Browse filesOn transformers 5.9, `create_causal_mask` no longer accepts a `cache_position` argument:
TypeError: create_causal_mask() got an unexpected keyword argument 'cache_position'
On 5.8 the parameter is present but documented as 'not used anymore but kept for BC'. Dropping the kwarg (and the now-unused `dummy_cache_position` computation) is compatible with both versions.
- modeling.py +0 -5
modeling.py
CHANGED
|
@@ -54,16 +54,11 @@ class PPLXQwen3Model(Qwen3Model):
|
|
| 54 |
inputs_embeds = self.embed_tokens(input_ids)
|
| 55 |
input_ids = None
|
| 56 |
|
| 57 |
-
# We construct a dummy tensor imitating initial positions
|
| 58 |
-
dummy_cache_position = torch.arange(
|
| 59 |
-
inputs_embeds.shape[1], device=inputs_embeds.device, dtype=torch.long
|
| 60 |
-
)
|
| 61 |
attention_mask = {
|
| 62 |
"full_attention": create_causal_mask(
|
| 63 |
config=self.config,
|
| 64 |
inputs_embeds=inputs_embeds,
|
| 65 |
attention_mask=attention_mask,
|
| 66 |
-
cache_position=dummy_cache_position,
|
| 67 |
past_key_values=None,
|
| 68 |
position_ids=position_ids,
|
| 69 |
or_mask_function=bidirectional_mask_function(attention_mask),
|
|
|
|
| 54 |
inputs_embeds = self.embed_tokens(input_ids)
|
| 55 |
input_ids = None
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
attention_mask = {
|
| 58 |
"full_attention": create_causal_mask(
|
| 59 |
config=self.config,
|
| 60 |
inputs_embeds=inputs_embeds,
|
| 61 |
attention_mask=attention_mask,
|
|
|
|
| 62 |
past_key_values=None,
|
| 63 |
position_ids=position_ids,
|
| 64 |
or_mask_function=bidirectional_mask_function(attention_mask),
|