# Điểm cuối suy luận

Inference Endpoints cung cấp giải pháp sản xuất an toàn để triển khai mô hình một cách dễ dàng trên hạ tầng chuyên dụng và tự động mở rộng do Hugging Face quản lý. Một Inference Endpoint được xây dựng từ một mô hình trên [Hub](https://huggingface.co/models). Trang này là tài liệu tham khảo cho tích hợp của `huggingface_hub` với Inference Endpoints. Để biết thêm thông tin về sản phẩm Inference Endpoints, hãy xem [tài liệu chính thức](https://huggingface.co/docs/inference-endpoints/index) của nó.

> [!TIP]
> Xem [hướng dẫn liên quan](../guides/inference_endpoints) để tìm hiểu cách sử dụng `huggingface_hub` để quản lý Inference Endpoints của bạn theo cách lập trình.

Inference Endpoints có thể được quản lý hoàn toàn qua API. Các endpoint được tài liệu hóa bằng [Swagger](https://api.endpoints.huggingface.cloud/). Lớp [InferenceEndpoint](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint) là một lớp bọc đơn giản được xây dựng dựa trên API này.

## Phương thức

Một tập con các tính năng của Inference Endpoint được triển khai trong [HfApi](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi):

- [get_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.get_inference_endpoint) và [list_inference_endpoints()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.list_inference_endpoints) để lấy thông tin về các Inference Endpoint của bạn
- [list_inference_endpoints_hardware()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.list_inference_endpoints_hardware) để liệt kê phần cứng mà bạn có thể triển khai Inference Endpoint
- [create_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.create_inference_endpoint), [update_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.update_inference_endpoint) và [delete_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.delete_inference_endpoint) để triển khai và quản lý Inference Endpoints
- [list_inference_catalog()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.list_inference_catalog) và [create_inference_endpoint_from_catalog()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.create_inference_endpoint_from_catalog) để xem và triển khai Model Catalog được tuyển chọn
- [pause_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.pause_inference_endpoint) và [resume_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.resume_inference_endpoint) để tạm dừng và tiếp tục một Inference Endpoint
- [scale_to_zero_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.scale_to_zero_inference_endpoint) để tự động scale Endpoint về 0 replicas

## InferenceEndpoint[[huggingface_hub.InferenceEndpoint]]

Dataclass chính là [InferenceEndpoint](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint). Nó chứa thông tin về một `InferenceEndpoint` đã được triển khai, bao gồm cấu hình và trạng thái hiện tại của nó. Sau khi triển khai, bạn có thể chạy suy luận trên Endpoint bằng cách sử dụng các thuộc tính [InferenceEndpoint.client](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint.client) và [InferenceEndpoint.async_client](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint.async_client), lần lượt trả về một đối tượng [InferenceClient](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_client#huggingface_hub.InferenceClient) và một đối tượng [AsyncInferenceClient](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_client#huggingface_hub.AsyncInferenceClient).

#### huggingface_hub.InferenceEndpoint[[huggingface_hub.InferenceEndpoint]]

```python
huggingface_hub.InferenceEndpoint(namespace: str, raw: dict, _token: str | bool | None, _api: HfApi)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L116)

**Tham số:**

name (`str`) : Tên duy nhất của Inference Endpoint.

namespace (`str`) : Không gian tên chứa Inference Endpoint.

repository (`str`) : Tên của kho mô hình được triển khai trên Inference Endpoint này.

status ([InferenceEndpointStatus](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpointStatus)) : Trạng thái hiện tại của Inference Endpoint.

url (`str`, *tùy chọn*) : URL của Inference Endpoint, nếu có. Chỉ Inference Endpoint đã triển khai mới có URL.

framework (`str`) : Khung machine learning được sử dụng cho mô hình.

revision (`str`) : Phiên bản mô hình cụ thể được triển khai trên Inference Endpoint.

task (`str`) : Nhiệm vụ liên quan đến mô hình đã triển khai.

created_at (`datetime.datetime`) : Thời điểm Inference Endpoint được tạo.

updated_at (`datetime.datetime`) : Thời gian cập nhật cuối cùng của Inference Endpoint.

type ([InferenceEndpointType](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpointType)) : Kiểu của Inference Endpoint (public, authenticated, private).

raw (`dict`) : Dữ liệu từ điển thô được trả về từ API.

token (`str` hoặc `bool`, *tùy chọn*) : Token xác thực cho Inference Endpoint, nếu được đặt khi yêu cầu API. Sẽ mặc định dùng token được lưu cục bộ nếu không được cung cấp. Truyền `token=False` nếu bạn không muốn gửi token của mình đến máy chủ.

Chứa thông tin về một Inference Endpoint đã triển khai.

Ví dụ:
```python
>>> from huggingface_hub import get_inference_endpoint
>>> endpoint = get_inference_endpoint("my-text-to-image")
>>> endpoint
InferenceEndpoint(name='my-text-to-image', ...)

# Get status
>>> endpoint.status
'running'
>>> endpoint.url
'https://68a0f3b5c6ee5c9dcc0e0a01.endpoints.huggingface.cloud'

# Run inference
>>> endpoint.client.text_to_image(...)

# Pause endpoint to save $$$
>>> endpoint.pause()

# ...
# Resume and wait for deployment
>>> endpoint.resume()
>>> endpoint.wait()
>>> endpoint.client.text_to_image(...)
```

#### from_raw[[huggingface_hub.InferenceEndpoint.from_raw]]

```python
from_raw(raw: dict, namespace: str, token: str | bool | None = None, api: typing.Optional[ForwardRef('HfApi')] = None)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L199)

Khởi tạo đối tượng từ từ điển thô.

#### client[[huggingface_hub.InferenceEndpoint.client]]

```python
client()
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L220)

**Trả về:** [InferenceClient](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_client#huggingface_hub.InferenceClient)

một client suy luận trỏ đến endpoint đã triển khai.

**Lỗi:** [InferenceEndpointError](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpointError)

- [InferenceEndpointError](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpointError) -- Nếu Inference Endpoint chưa được triển khai.

Trả về một client để thực hiện dự đoán trên Inference Endpoint này.

#### async_client[[huggingface_hub.InferenceEndpoint.async_client]]

```python
async_client()
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L242)

**Trả về:** [AsyncInferenceClient](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_client#huggingface_hub.AsyncInferenceClient)

một client suy luận tương thích với asyncio, trỏ đến endpoint đã triển khai.

**Lỗi:** [InferenceEndpointError](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpointError)

- [InferenceEndpointError](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpointError) -- Nếu Inference Endpoint chưa được triển khai.

Trả về một client để thực hiện dự đoán trên Inference Endpoint này.

#### xóa[[huggingface_hub.InferenceEndpoint.delete]]

```python
delete()
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L487)

Xóa Inference Endpoint.

Thao tác này không thể đảo ngược. Nếu bạn không muốn bị tính phí cho một Inference Endpoint, tốt hơn hết là hãy tạm dừng nó bằng [InferenceEndpoint.pause()](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint.pause) hoặc thu nhỏ nó về không bằng [InferenceEndpoint.scale_to_zero()](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint.scale_to_zero).

Đây là một alias cho [HfApi.delete_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.delete_inference_endpoint).

#### fetch[[huggingface_hub.InferenceEndpoint.fetch]]

```python
fetch()
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L317)

**Trả về:** [InferenceEndpoint](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint)

cùng một Inference Endpoint, được thay đổi tại chỗ bằng dữ liệu mới nhất.

Lấy thông tin mới nhất về Inference Endpoint.

#### tạm dừng[[huggingface_hub.InferenceEndpoint.pause]]

```python
pause()
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L430)

**Trả về:** [InferenceEndpoint](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint)

cùng một Inference Endpoint, được thay đổi tại chỗ bằng dữ liệu mới nhất.

Tạm dừng Inference Endpoint.

Inference Endpoint ở trạng thái tạm dừng sẽ không bị tính phí. Bạn có thể tiếp tục sử dụng nó bất cứ lúc nào bằng [InferenceEndpoint.resume()](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint.resume). Điều này khác với việc scale Inference Endpoint về 0 bằng [InferenceEndpoint.scale_to_zero()](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint.scale_to_zero), khi đó nó sẽ tự động khởi động lại khi có yêu cầu được gửi đến.

Đây là một alias cho [HfApi.pause_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.pause_inference_endpoint). Đối tượng hiện tại sẽ được thay đổi tại chỗ bằng dữ liệu mới nhất từ máy chủ.

#### tiếp tục[[huggingface_hub.InferenceEndpoint.resume]]

```python
resume(running_ok: bool = True)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L448)

**Tham số:**

running_ok (`bool`, *tuỳ chọn*) : Nếu `True`, phương thức sẽ không gây ra lỗi nếu Inference Endpoint đã đang chạy. Mặc định là `True`.

**Trả về:** [InferenceEndpoint](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint)

cùng một Inference Endpoint, được thay đổi tại chỗ bằng dữ liệu mới nhất.

Tiếp tục Inference Endpoint.

Đây là một alias cho [HfApi.resume_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.resume_inference_endpoint). Đối tượng hiện tại sẽ được thay đổi tại chỗ bằng dữ liệu mới nhất từ máy chủ.

#### scale_to_zero[[huggingface_hub.InferenceEndpoint.scale_to_zero]]

```python
scale_to_zero()
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L469)

**Trả về:** [InferenceEndpoint](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint)

cùng một Inference Endpoint, được thay đổi tại chỗ bằng dữ liệu mới nhất.

Thang đo điểm cuối suy luận về không.

Inference Endpoint được scale về 0 sẽ không bị tính phí. Nó sẽ được khởi động lại ở lần yêu cầu tiếp theo, kèm theo độ trễ khởi động lạnh. Điều này khác với việc tạm dừng Inference Endpoint bằng [InferenceEndpoint.pause()](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint.pause), khi đó sẽ cần khởi động lại thủ công bằng [InferenceEndpoint.resume()](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint.resume).

Đây là một alias cho [HfApi.scale_to_zero_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.scale_to_zero_inference_endpoint). Đối tượng hiện tại sẽ bị thay đổi tại chỗ bằng dữ liệu mới nhất từ máy chủ.

#### cập nhật[[huggingface_hub.InferenceEndpoint.update]]

```python
update(accelerator: str | None = None, instance_size: str | None = None, instance_type: str | None = None, min_replica: int | None = None, max_replica: int | None = None, scale_to_zero_timeout: int | None = None, repository: str | None = None, framework: str | None = None, revision: str | None = None, task: str | None = None, custom_image: dict | None = None, container_command: list[str] | None = None, container_args: list[str] | None = None, tensor_parallel_size: int | None = None, data_parallel_size: int | None = None, secrets: dict[str, str] | None = None)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L328)

**Tham số:**

accelerator (`str`, *tùy chọn*) : Bộ tăng tốc phần cứng sẽ được sử dụng cho suy luận (ví dụ: `"cpu"`).

instance_size (`str`, *tùy chọn*) : Kích thước hoặc kiểu của instance sẽ được sử dụng để lưu trữ mô hình (ví dụ: `"x4"`).

instance_type (`str`, *tùy chọn*) : Kiểu instance trên cloud mà Inference Endpoint sẽ được triển khai (ví dụ: `"intel-icl"`).

min_replica (`int`, *tuỳ chọn*) : Số lượng tối thiểu các bản sao (instance) cần giữ cho đang chạy đối với Inference Endpoint.

max_replica (`int`, *tuỳ chọn*) : Số lượng bản sao (thực thể) tối đa để mở rộng cho Inference Endpoint.

scale_to_zero_timeout (`int`, *tuỳ chọn*) : Thời lượng tính bằng phút trước khi một endpoint không hoạt động bị thu về mức không.

repository (`str`, *tùy chọn*) : Tên của kho mô hình liên quan đến Inference Endpoint (ví dụ: `"gpt2"`).

framework (`str`, *tùy chọn*) : Khung học máy được sử dụng cho mô hình (ví dụ: `"custom"`).

revision (`str`, *tùy chọn*) : Phiên bản mô hình cụ thể để triển khai trên Inference Endpoint (ví dụ: `"6c0e6080953db56375760c0471a8c5f2929baf11"`).

task (`str`, *tùy chọn*) : Nhiệm vụ để triển khai mô hình (ví dụ: `"text-classification"`).

custom_image (`dict`, *tùy chọn*) : Ảnh container để chạy. Có thể là một dict có khóa theo biến thể ảnh (ví dụ `{"vLLM": {"url": "vllm/vllm-openai:v0.23.0", "port": 8000}}`, cũng như `sGLang`, `tgi`, `tei`, `llamacpp`, `hfServe`, ...), được chuyển tiếp nguyên vẹn, hoặc một dict phẳng mô tả một container tùy chỉnh (ví dụ `{"url": ..., "port": ...}`), được gửi dưới dạng `{"custom": ...}`.

container_command (`list[str]`, *tùy chọn*) : Ghi đè lệnh entrypoint của container (tương ứng với `model.command` trong API payload). Hoạt động với cả các hình ảnh engine được quản lý (ví dụ: vLLM, SGLang) và các hình ảnh tùy chỉnh.

container_args (`list[str]`, *tùy chọn*) : Các đối số được thêm vào entrypoint của container (tương ứng với `model.args` trong API payload). Hoạt động với cả các image engine được quản lý (ví dụ: vLLM, SGLang) và các image tùy chỉnh.

tensor_parallel_size (`int`, *optional*) : Số lượng bộ tăng tốc để chia nhỏ một bản sao mô hình duy nhất (ảnh vLLM và SGLang). Khi `custom_image` không được cung cấp, ảnh hiện đang được cấu hình trên endpoint sẽ được lấy về và cập nhật tại chỗ, vì API yêu cầu `model.image` như một tổng thể.

data_parallel_size (`int`, *tuỳ chọn*) : Số lượng bản sao mô hình cần chạy, mỗi bộ tăng tốc một bản (ảnh vLLM).

secrets (`dict[str, str]`, *tùy chọn*) : Các giá trị bí mật để tiêm vào môi trường của container.

**Trả về:** [InferenceEndpoint](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint)

cùng một Inference Endpoint, được thay đổi tại chỗ bằng dữ liệu mới nhất.

Cập nhật Inference Endpoint.

Phương pháp này cho phép cập nhật cấu hình tính toán, mô hình đã triển khai, hoặc cả hai. Tất cả các đối số đều là tùy chọn nhưng ít nhất một đối số phải được cung cấp.

Đây là một alias cho [HfApi.update_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.update_inference_endpoint). Đối tượng hiện tại sẽ được thay đổi tại chỗ bằng dữ liệu mới nhất từ máy chủ.

#### chờ[[huggingface_hub.InferenceEndpoint.wait]]

```python
wait(timeout: int | None = None, refresh_every: int = 5)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L264)

**Tham số:**

timeout (`int`, *optional*) : Thời gian tối đa để chờ Inference Endpoint được triển khai, tính bằng giây. Nếu `None`, sẽ chờ vô thời hạn.

refresh_every (`int`, *optional*) : Thời gian chờ giữa mỗi lần lấy trạng thái của Inference Endpoint, tính bằng giây. Mặc định là 5s.

**Trả về:** [InferenceEndpoint](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint)

cùng một Inference Endpoint, được thay đổi tại chỗ bằng dữ liệu mới nhất.

**Lỗi:** [InferenceEndpointError](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpointError) hoặc `InferenceEndpointTimeoutError`

- [InferenceEndpointError](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpointError) -- Nếu Inference Endpoint rơi vào trạng thái thất bại.
- `InferenceEndpointTimeoutError` -- Nếu Inference Endpoint không được triển khai sau `timeout` giây.

Chờ cho đến khi Inference Endpoint được triển khai.

Thông tin từ máy chủ sẽ được lấy mỗi 1 giây. Nếu Inference Endpoint không được triển khai sau `timeout` giây, một `InferenceEndpointTimeoutError` sẽ được ném ra. [InferenceEndpoint](/docs/huggingface_hub/v2.4.0/vi/package_reference/inference_endpoints#huggingface_hub.InferenceEndpoint) sẽ được thay đổi tại chỗ với dữ liệu mới nhất.

## InferenceEndpointHardware[[huggingface_hub.InferenceEndpointHardware]]

#### huggingface_hub.InferenceEndpointHardware[[huggingface_hub.InferenceEndpointHardware]]

```python
huggingface_hub.InferenceEndpointHardware(id: str, vendor: str, region: str, accelerator: str, instance_type: str, instance_size: str, architecture: str, num_accelerators: int, num_cpus: int | None, memory_gb: float, gpu_memory_gb: int | None, price_per_hour: float, status: str, max_accelerators: int, used_accelerators: int)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L519)

**Tham số:**

id (`str`) : Định danh phần cứng duy nhất, ví dụ `"aws-us-east-1-nvidia-l4-x1"`.

vendor (`str`) : Nhà cung cấp cloud lưu trữ phần cứng, ví dụ `"aws"`.

region (`str`) : Vùng cloud mà phần cứng có sẵn, ví dụ `"us-east-1"`.

accelerator (`str`) : Loại bộ tăng tốc phần cứng, ví dụ `"cpu"`, `"gpu"` hoặc `"neuron"`.

instance_type (`str`) : Kiểu instance trên cloud, ví dụ `"nvidia-l4"`.

instance_size (`str`) : Hệ số nhân kích thước instance, ví dụ `"x1"`.

architecture (`str`) : Mô tả phần cứng dễ đọc, ví dụ `"Nvidia L4"`.

num_accelerators (`int`) : Số lượng đơn vị tăng tốc trên mỗi bản sao.

num_cpus (`int`, *tùy chọn*) : Số lượng vCPU trên mỗi bản sao.

memory_gb (`float`) : RAM cho mỗi bản sao, tính bằng GB.

gpu_memory_gb (`int`, *tuỳ chọn*) : Tổng bộ nhớ GPU trên mỗi bản sao, tính bằng GB (tức là tổng trên `num_accelerators`). `None` cho phần cứng không phải GPU.

price_per_hour (`float`) : Chi phí cho mỗi bản sao mỗi giờ, tính bằng USD.

status (`str`) : Trạng thái khả dụng của phần cứng: `"available"`, `"low_availability"`, `"not_available"`, `"reserved"` hoặc `"deprecated"`.

max_accelerators (`int`) : Số lượng tối đa các bộ tăng tốc thuộc loại này mà namespace được phép chạy.

used_accelerators (`int`) : Số lượng bộ tăng tốc của loại này hiện đang được sử dụng bởi namespace.

Chứa thông tin về một cấu hình phần cứng có sẵn cho Inference Endpoints.

Các trường `vendor`, `region`, `accelerator`, `instance_type` và `instance_size` chính là các giá trị cần truyền vào [create_inference_endpoint()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.create_inference_endpoint) (hoặc `hf endpoints deploy`) để triển khai trên phần cứng này.

Ví dụ:
```python
>>> from huggingface_hub import list_inference_endpoints_hardware
>>> hardware = list_inference_endpoints_hardware()
>>> hardware[0]
InferenceEndpointHardware(id='aws-us-east-1-nvidia-l4-x1', vendor='aws', region='us-east-1', ...)
```

#### from_raw[[huggingface_hub.InferenceEndpointHardware.from_raw]]

```python
from_raw(raw: dict, vendor: str, region: str)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L584)

Khởi tạo đối tượng từ một từ điển tính toán thô, nằm lồng nhau dưới một nhà cung cấp và một khu vực trong phản hồi API.

## InferenceCatalogModel[[huggingface_hub.InferenceCatalogModel]]

#### huggingface_hub.InferenceCatalogModel[[huggingface_hub.InferenceCatalogModel]]

```python
huggingface_hub.InferenceCatalogModel(repo_id: str, name: str, author: str, license: str, task: str, created_at: datetime, recipes: list)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L647)

**Tham số:**

repo_id (`str`) : id của kho mô hình trên Hub, ví dụ `"meta-llama/Llama-3.1-8B-Instruct"`.

name (`str`) : Tên mô hình, tức là phần của `repo_id` sau tên tác giả, ví dụ `"Llama-3.1-8B-Instruct"`.

author (`str`) : Tác giả của kho lưu trữ mô hình, ví dụ `"meta-llama"`.

license (`str`) : Giấy phép của mô hình, ví dụ `"Apache 2.0"`.

task (`str`) : Nhiệm vụ mà mô hình được triển khai, ví dụ `"text-generation"`.

created_at (`datetime`) : Ngày mô hình được thêm vào danh mục.

recipes (`list[InferenceCatalogRecipe]`) : Các cách triển khai mô hình này đã được kiểm thử.

Chứa thông tin về một mô hình có sẵn trong Inference Catalog.

Ví dụ:
```python
>>> from huggingface_hub import list_inference_catalog
>>> catalog = list_inference_catalog(engine="vllm")
>>> catalog[0]
InferenceCatalogModel(repo_id='Qwen/Qwen2.5-Coder-7B-Instruct', name='Qwen2.5-Coder-7B-Instruct', ...)
```

#### from_raw[[huggingface_hub.InferenceCatalogModel.from_raw]]

```python
from_raw(raw: dict)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L684)

Khởi tạo đối tượng từ một từ điển mục danh mục thô.

## InferenceCatalogRecipe[[huggingface_hub.InferenceCatalogRecipe]]

#### huggingface_hub.InferenceCatalogRecipe[[huggingface_hub.InferenceCatalogRecipe]]

```python
huggingface_hub.InferenceCatalogRecipe(id: str, accelerator: str, engine: str, gguf_file: str | None, revision: str | None)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L608)

**Tham số:**

id (`str`) : id của công thức công khai, để truyền vào [create_inference_endpoint_from_catalog()](/docs/huggingface_hub/v2.4.0/vi/package_reference/hf_api#huggingface_hub.HfApi.create_inference_endpoint_from_catalog) dưới dạng `recipe_id`.

accelerator (`str`) : Loại bộ tăng tốc phần cứng mà công thức chạy trên đó, ví dụ `"cpu"`, `"gpu"` hoặc `"neuron"`.

engine (`str`) : Bộ máy suy luận mà công thức chạy, ví dụ `"vllm"`, `"llamacpp"`, `"tei"` hoặc `"sglang"`.

gguf_file (`str`, *tùy chọn*) : Tệp GGUF được triển khai bởi công thức. Chỉ được đặt cho các công thức `"llamacpp"`.

revision (`str`, *tùy chọn*) : Phiên bản mô hình mà công thức được cố định vào, nếu có.

Chứa thông tin về một cách triển khai mô hình đã được kiểm tra trước từ Inference Catalog.

Một recipe là sự kết hợp giữa phần cứng và engine mà nhóm Inference Endpoints đã kiểm tra cho một model nhất định. Một model thường có một recipe, nhưng cũng có thể có nhiều (ví dụ: một recipe cho GPU và một recipe cho Neuron, hoặc một recipe cho mỗi mức lượng tử hóa GGUF).

#### from_raw[[huggingface_hub.InferenceCatalogRecipe.from_raw]]

```python
from_raw(raw: dict)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L634)

Khởi tạo đối tượng từ một từ điển công thức thô, nằm lồng bên dưới một mô hình trong phản hồi API.

## InferenceEndpointStatus[[huggingface_hub.InferenceEndpointStatus]]

#### huggingface_hub.InferenceEndpointStatus[[huggingface_hub.InferenceEndpointStatus]]

```python
huggingface_hub.InferenceEndpointStatus(value, names = None, module = None, qualname = None, type = None, start = 1)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L93)

Một kiểu liệt kê.

## InferenceEndpointType[[huggingface_hub.InferenceEndpointType]]

#### huggingface_hub.InferenceEndpointType[[huggingface_hub.InferenceEndpointType]]

```python
huggingface_hub.InferenceEndpointType(value, names = None, module = None, qualname = None, type = None, start = 1)
```

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/_inference_endpoints.py#L104)

Một kiểu liệt kê.

## InferenceEndpointError[[huggingface_hub.InferenceEndpointError]]

#### huggingface_hub.InferenceEndpointError[[huggingface_hub.InferenceEndpointError]]

[Nguồn](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L162)

Lỗi ngoại lệ chung khi làm việc với Inference Endpoints.

