# AscendEmbeddings

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/embeddings/ascend/AscendEmbeddings)

Ascend NPU accelerate Embedding model

Please ensure that you have installed CANN and torch_npu.

Example:

from langchain_community.embeddings import AscendEmbeddings
model = AscendEmbeddings(model_path=<path_to_model>,
    device_id=0,
    query_instruction="Represent this sentence for searching relevant passages: "
)

## Signature

```python
AscendEmbeddings(
    self,
    *args: Any = (),
    **kwargs: Any = {},
)
```

## Extends

- `Embeddings`
- `BaseModel`

## Constructors

```python
__init__(
    self,
    *args: Any = (),
    **kwargs: Any = {},
) -> None
```


## Properties

- `model_path`
- `device_id`
- `query_instruction`
- `document_instruction`
- `use_fp16`
- `pooling_method`
- `batch_size`
- `model`
- `tokenizer`
- `model_config`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-community/embeddings/ascend/AscendEmbeddings/validate_environment)
- [`encode()`](https://reference.langchain.com/python/langchain-community/embeddings/ascend/AscendEmbeddings/encode)
- [`pooling()`](https://reference.langchain.com/python/langchain-community/embeddings/ascend/AscendEmbeddings/pooling)
- [`embed_documents()`](https://reference.langchain.com/python/langchain-community/embeddings/ascend/AscendEmbeddings/embed_documents)
- [`embed_query()`](https://reference.langchain.com/python/langchain-community/embeddings/ascend/AscendEmbeddings/embed_query)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/embeddings/ascend.py#L8)