Triển khai model YOLO được pretrained với Ultralytics trên Vertex AI để inference#
Hướng dẫn này sẽ chỉ cho bạn cách containerize model YOLO26 được pretrained với Ultralytics, xây dựng inference server FastAPI cho model đó và triển khai model cùng inference server trên Google Cloud Vertex AI. Phần triển khai ví dụ sẽ tập trung vào use case phát hiện đối tượng cho YOLO26, nhưng các nguyên tắc tương tự cũng áp dụng khi sử dụng các mode YOLO khác.
Trước khi bắt đầu, bạn cần tạo một project Google Cloud Platform (GCP). Người dùng mới sẽ nhận được $300 credit GCP miễn phí, và số tiền này đủ để thử nghiệm một setup đang chạy mà sau đó bạn có thể mở rộng cho bất kỳ use case YOLO26 nào khác, bao gồm training hoặc inference theo batch và streaming.
Bạn sẽ học được gì#
- Tạo inference backend cho model Ultralytics YOLO26 bằng FastAPI.
- Tạo repository GCP Artifact Registry để lưu trữ Docker image.
- Build và push Docker image cùng model lên Artifact Registry.
- Import model vào Vertex AI.
- Tạo Vertex AI endpoint và triển khai model.
- Toàn quyền kiểm soát model với Ultralytics: Bạn có thể sử dụng inference logic tùy chỉnh với toàn quyền kiểm soát preprocessing, postprocessing và định dạng response.
- Vertex AI xử lý phần còn lại: Dịch vụ tự động scale, đồng thời vẫn linh hoạt trong việc cấu hình compute resources, memory và GPU.
- Tích hợp GCP native và bảo mật: Thiết lập liền mạch với Cloud Storage, BigQuery, Cloud Functions, các kiểm soát VPC, chính sách IAM và audit log.
Điều kiện tiên quyết#
- Cài đặt Docker trên máy của bạn.
- Cài đặt Google Cloud SDK và xác thực để sử dụng gcloud CLI.
- Bạn rất nên xem qua Docker Quickstart Guide cho Ultralytics, vì bạn sẽ cần mở rộng một trong các Docker image chính thức của Ultralytics khi làm theo hướng dẫn này.
1. Tạo inference backend với FastAPI#
Trước tiên, bạn cần tạo một ứng dụng FastAPI để phục vụ các request inference của model YOLO26. Ứng dụng này sẽ xử lý việc load model, preprocessing ảnh và logic inference (prediction).
Các nguyên tắc cơ bản về compliance của Vertex AI#
Vertex AI yêu cầu container của bạn triển khai hai endpoint cụ thể:
-
Endpoint Health (
/health): Phải trả về HTTP status200 OKkhi service đã sẵn sàng. -
Endpoint Predict (
/predict): Chấp nhận các request prediction có cấu trúc, chứa ảnh được mã hóa base64 và các tham số tùy chọn. Các giới hạn kích thước payload được áp dụng tùy theo loại endpoint.Payload request cho endpoint
/predictphải tuân theo cấu trúc JSON sau:{ "instances": [{ "image": "base64_encoded_image" }], "parameters": { "confidence": 0.5 } }
Cấu trúc thư mục project#
Phần lớn quá trình build sẽ diễn ra bên trong Docker container, và Ultralytics cũng sẽ load một model YOLO26 được pretrained, vì vậy bạn có thể giữ cấu trúc thư mục local đơn giản:
YOUR_PROJECT/
├── src/
│ ├── __init__.py
│ ├── app.py # Core YOLO26 inference logic
│ └── main.py # FastAPI inference server
├── tests/
├── .env # Environment variables for local development
├── Dockerfile # Container configuration
├── LICENSE # AGPL-3.0 License
└── pyproject.toml # Python dependencies and project configCác model và framework Ultralytics YOLO26 được cấp phép theo AGPL-3.0, đi kèm các yêu cầu compliance quan trọng. Hãy đọc tài liệu Ultralytics về cách tuân thủ các điều khoản license.
Tạo pyproject.toml với các dependency#
Để quản lý project thuận tiện, hãy tạo file pyproject.toml với các dependency sau:
[project]
name = "YOUR_PROJECT_NAME"
version = "0.0.1"
description = "YOUR_PROJECT_DESCRIPTION"
requires-python = ">=3.10,<3.13"
dependencies = [
"ultralytics>=8.3.0",
"fastapi[all]>=0.89.1",
"uvicorn[standard]>=0.20.0",
"pillow>=9.0.0",
]
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"uvicornsẽ được sử dụng để chạy FastAPI server.pillowsẽ được sử dụng để xử lý ảnh, nhưng bạn không bị giới hạn chỉ ở ảnh PIL — Ultralytics hỗ trợ nhiều format khác.
Tạo inference logic với Ultralytics YOLO26#
Sau khi đã thiết lập cấu trúc project và các dependency, bạn có thể triển khai inference logic cốt lõi của YOLO26. Tạo file src/app.py để xử lý việc load model, xử lý ảnh và prediction bằng Ultralytics Python API.
# src/app.py
from ultralytics import YOLO
# Model initialization and readiness state
model_yolo = None
_model_ready = False
def _initialize_model():
"""Initialize the YOLO model."""
global model_yolo, _model_ready
try:
# Use pretrained YOLO26n model from Ultralytics base image
model_yolo = YOLO("yolo26n.pt")
_model_ready = True
except Exception as e:
print(f"Error initializing YOLO model: {e}")
_model_ready = False
model_yolo = None
# Initialize model on module import
_initialize_model()
def is_model_ready() -> bool:
"""Check if the model is ready for inference."""
return _model_ready and model_yolo is not NoneModel sẽ được load một lần khi container khởi động và được dùng chung cho tất cả request. Nếu model của bạn phải xử lý tải inference lớn, bạn nên chọn machine type có nhiều memory hơn khi import model vào Vertex AI ở bước sau.
Tiếp theo, hãy tạo hai utility function để xử lý ảnh đầu vào và đầu ra bằng pillow. YOLO26 hỗ trợ native ảnh PIL.
def get_image_from_bytes(binary_image: bytes) -> Image.Image:
"""Convert image from bytes to PIL RGB format."""
input_image = Image.open(io.BytesIO(binary_image)).convert("RGB")
return input_imagedef get_bytes_from_image(image: Image.Image) -> bytes:
"""Convert PIL image to bytes."""
return_image = io.BytesIO()
image.save(return_image, format="JPEG", quality=85)
return_image.seek(0)
return return_image.getvalue()Cuối cùng, triển khai function run_inference để xử lý việc phát hiện đối tượng. Trong ví dụ này, chúng ta sẽ trích xuất bounding box, tên class và confidence score từ prediction của model. Function sẽ trả về một dictionary chứa các detection và raw result để tiếp tục xử lý hoặc annotation.
def run_inference(input_image: Image.Image, confidence_threshold: float = 0.5) -> Dict[str, Any]:
"""Run inference on an image using YOLO26n model."""
# Check if model is ready
if not is_model_ready():
print("Model not ready for inference")
return {"detections": [], "results": None}
try:
# Make predictions and get raw results
results = model_yolo.predict(
imgsz=640, source=input_image, conf=confidence_threshold, save=False, augment=False, verbose=False
)
# Extract detections (bounding boxes, class names, and confidences)
detections = []
if results and len(results) > 0:
result = results[0]
if result.boxes is not None and len(result.boxes.xyxy) > 0:
boxes = result.boxes
# Convert tensors to numpy for processing
xyxy = boxes.xyxy.cpu().numpy()
conf = boxes.conf.cpu().numpy()
cls = boxes.cls.cpu().numpy().astype(int)
# Create detection dictionaries
for i in range(len(xyxy)):
detection = {
"xmin": float(xyxy[i][0]),
"ymin": float(xyxy[i][1]),
"xmax": float(xyxy[i][2]),
"ymax": float(xyxy[i][3]),
"confidence": float(conf[i]),
"class": int(cls[i]),
"name": model_yolo.names.get(int(cls[i]), f"class_{int(cls[i])}"),
}
detections.append(detection)
return {
"detections": detections,
"results": results, # Keep raw results for annotation
}
except Exception as e:
# If there's an error, return empty structure
print(f"Error in YOLO detection: {e}")
return {"detections": [], "results": None}Tùy chọn, bạn có thể thêm một function để annotate ảnh bằng bounding box và label sử dụng plotting method tích hợp sẵn của Ultralytics. Điều này hữu ích nếu bạn muốn trả về ảnh đã annotation trong prediction response.
def get_annotated_image(results: list) -> Image.Image:
"""Get annotated image using Ultralytics built-in plot method."""
if not results or len(results) == 0:
raise ValueError("No results provided for annotation")
result = results[0]
# Use Ultralytics built-in plot method with PIL output
return result.plot(pil=True)Tạo HTTP inference server với FastAPI#
Sau khi đã có inference logic cốt lõi của YOLO26, bạn có thể tạo ứng dụng FastAPI để phục vụ logic này. Ứng dụng sẽ bao gồm health check endpoint và prediction endpoint theo yêu cầu của Vertex AI.
Trước tiên, hãy thêm các import và cấu hình logging cho Vertex AI. Vì Vertex AI coi stderr là output lỗi, việc chuyển log sang stdout sẽ hợp lý hơn.
import sys
from loguru import logger
# Configure logger
logger.remove()
logger.add(
sys.stdout,
colorize=True,
format="<green>{time:HH:mm:ss}</green> | <level>{message}</level>",
level=10,
)
logger.add("log.log", rotation="1 MB", level="DEBUG", compression="zip")Để đảm bảo compliance đầy đủ với Vertex AI, hãy định nghĩa các endpoint bắt buộc trong biến môi trường và đặt giới hạn kích thước cho request. Bạn nên sử dụng private Vertex AI endpoint cho các deployment production. Nhờ đó, bạn sẽ có giới hạn payload request cao hơn (10 MB thay vì 1.5 MB đối với public endpoint), cùng với khả năng bảo mật và kiểm soát quyền truy cập mạnh mẽ.
# Vertex AI environment variables
AIP_HTTP_PORT = int(os.getenv("AIP_HTTP_PORT", "8080"))
AIP_HEALTH_ROUTE = os.getenv("AIP_HEALTH_ROUTE", "/health")
AIP_PREDICT_ROUTE = os.getenv("AIP_PREDICT_ROUTE", "/predict")
# Request size limit (10 MB for private endpoints, 1.5 MB for public)
MAX_REQUEST_SIZE = 10 * 1024 * 1024 # 10 MB in bytesThêm hai model Pydantic để validate request và response của bạn:
# Pydantic models for request/response
class PredictionRequest(BaseModel):
instances: list
parameters: Optional[Dict[str, Any]] = None
class PredictionResponse(BaseModel):
predictions: listThêm health check endpoint để xác minh model đã sẵn sàng. Điều này rất quan trọng đối với Vertex AI, vì nếu không có health check chuyên dụng, orchestrator của dịch vụ sẽ ping các socket ngẫu nhiên và không thể xác định model đã sẵn sàng cho inference hay chưa. Health check phải trả về 200 OK khi thành công và 503 Service Unavailable khi thất bại:
# Health check endpoint
@app.get(AIP_HEALTH_ROUTE, status_code=status.HTTP_200_OK)
def health_check():
"""Health check endpoint for Vertex AI."""
if not is_model_ready():
raise HTTPException(status_code=503, detail="Model not ready")
return {"status": "healthy"}Bây giờ bạn đã có mọi thứ cần thiết để triển khai prediction endpoint xử lý các inference request. Endpoint sẽ nhận một file ảnh, chạy inference và trả về kết quả. Lưu ý rằng ảnh phải được mã hóa base64, điều này cũng làm tăng kích thước payload lên tối đa 33%.
@app.post(AIP_PREDICT_ROUTE, response_model=PredictionResponse)
async def predict(request: PredictionRequest):
"""Prediction endpoint for Vertex AI."""
try:
predictions = []
for instance in request.instances:
if isinstance(instance, dict):
if "image" in instance:
image_data = base64.b64decode(instance["image"])
input_image = get_image_from_bytes(image_data)
else:
raise HTTPException(status_code=400, detail="Instance must contain 'image' field")
else:
raise HTTPException(status_code=400, detail="Invalid instance format")
# Extract YOLO26 parameters if provided
parameters = request.parameters or {}
confidence_threshold = parameters.get("confidence", 0.5)
return_annotated_image = parameters.get("return_annotated_image", False)
# Run inference with YOLO26n model
result = run_inference(input_image, confidence_threshold=confidence_threshold)
detections_list = result["detections"]
# Format predictions for Vertex AI
detections = []
for detection in detections_list:
formatted_detection = {
"class": detection["name"],
"confidence": detection["confidence"],
"bbox": {
"xmin": detection["xmin"],
"ymin": detection["ymin"],
"xmax": detection["xmax"],
"ymax": detection["ymax"],
},
}
detections.append(formatted_detection)
# Build prediction response
prediction = {"detections": detections, "detection_count": len(detections)}
# Add annotated image if requested and detections exist
if (
return_annotated_image
and result["results"]
and result["results"][0].boxes is not None
and len(result["results"][0].boxes) > 0
):
import base64
annotated_image = get_annotated_image(result["results"])
img_bytes = get_bytes_from_image(annotated_image)
prediction["annotated_image"] = base64.b64encode(img_bytes).decode("utf-8")
predictions.append(prediction)
logger.info(
f"Processed {len(request.instances)} instances, found {sum(len(p['detections']) for p in predictions)} total detections"
)
return PredictionResponse(predictions=predictions)
except HTTPException:
# Re-raise HTTPException as-is (don't catch and convert to 500)
raise
except Exception as e:
logger.error(f"Prediction error: {e}")
raise HTTPException(status_code=500, detail=f"Prediction failed: {e}")Cuối cùng, thêm entry point của ứng dụng để chạy FastAPI server.
if __name__ == "__main__":
import uvicorn
logger.info(f"Starting server on port {AIP_HTTP_PORT}")
logger.info(f"Health check route: {AIP_HEALTH_ROUTE}")
logger.info(f"Predict route: {AIP_PREDICT_ROUTE}")
uvicorn.run(app, host="0.0.0.0", port=AIP_HTTP_PORT)Bây giờ bạn đã có một ứng dụng FastAPI hoàn chỉnh có thể phục vụ các inference request của YOLO26. Bạn có thể test ứng dụng local bằng cách cài đặt các dependency và chạy server, chẳng hạn bằng uv.
# Install dependencies
uv pip install -e .
# Run the FastAPI server directly
uv run src/main.pyĐể test server, bạn có thể query cả hai endpoint /health và /predict bằng cURL. Đặt một ảnh test vào thư mục tests. Sau đó, trong Terminal, chạy các command sau:
# Test health endpoint
curl http://localhost:8080/health
# Test predict endpoint with base64 encoded image
curl -X POST -H "Content-Type: application/json" -d "{\"instances\": [{\"image\": \"$(base64 -i tests/test_image.jpg)\"}]}" http://localhost:8080/predictBạn sẽ nhận được JSON response chứa các đối tượng được phát hiện. Ở request đầu tiên, hãy chờ một khoảng trễ ngắn vì Ultralytics cần pull và load model YOLO26.
2. Mở rộng Ultralytics Docker image bằng ứng dụng của bạn#
Ultralytics cung cấp một số Docker image mà bạn có thể dùng làm base cho application image. Docker sẽ cài đặt Ultralytics và các GPU driver cần thiết.
Để sử dụng đầy đủ khả năng của các model Ultralytics YOLO, bạn nên chọn image được tối ưu cho CUDA để inference trên GPU. Tuy nhiên, nếu inference trên CPU đã đủ cho tác vụ của bạn, bạn cũng có thể tiết kiệm compute resource bằng cách chọn image chỉ dành cho CPU:
- Dockerfile: Image được tối ưu cho CUDA để training và inference YOLO26 trên một hoặc nhiều GPU.
- Dockerfile-cpu: Image chỉ dành cho CPU để inference YOLO26.
Tạo Docker image cho ứng dụng của bạn#
Tạo file Dockerfile tại thư mục gốc của project với nội dung sau:
# Extends official Ultralytics Docker image for YOLO26
FROM ultralytics/ultralytics:latest
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# Install FastAPI and dependencies
RUN uv pip install fastapi[all] uvicorn[standard] loguru
WORKDIR /app
COPY src/ ./src/
COPY pyproject.toml ./
# Install the application package
RUN uv pip install -e .
RUN mkdir -p /app/logs
ENV PYTHONPATH=/app/src
# Port for Vertex AI
EXPOSE 8080
# Start the inference server
ENTRYPOINT ["python", "src/main.py"]Trong ví dụ này, Docker image chính thức của Ultralytics ultralytics:latest được sử dụng làm base. Image đã chứa model YOLO26 và tất cả dependency cần thiết. Entrypoint của server giống với entrypoint được sử dụng để test ứng dụng FastAPI local.
Build và test Docker image#
Bây giờ bạn có thể build Docker image bằng command sau:
docker build --platform linux/amd64 -t IMAGE_NAME:IMAGE_VERSION .Thay IMAGE_NAME và IMAGE_VERSION bằng các giá trị bạn muốn, chẳng hạn yolo26-fastapi:0.1. Lưu ý rằng bạn phải build image cho architecture linux/amd64 nếu triển khai trên Vertex AI. Tham số --platform phải được set rõ ràng nếu bạn build image trên máy Mac Apple Silicon hoặc bất kỳ architecture không phải x86 nào khác.
Sau khi build image hoàn tất, bạn có thể test Docker image local:
docker run --platform linux/amd64 -p 8080:8080 IMAGE_NAME:IMAGE_VERSIONDocker container của bạn hiện đang chạy FastAPI server trên port 8080, sẵn sàng tiếp nhận inference request. Bạn có thể test cả hai endpoint /health và /predict bằng các command cURL như trước:
# Test health endpoint
curl http://localhost:8080/health
# Test predict endpoint with base64 encoded image
curl -X POST -H "Content-Type: application/json" -d "{\"instances\": [{\"image\": \"$(base64 -i tests/test_image.jpg)\"}]}" http://localhost:8080/predict3. Upload Docker image lên GCP Artifact Registry#
Để import model đã containerize vào Vertex AI, bạn cần upload Docker image lên Google Cloud Artifact Registry. Nếu chưa có repository Artifact Registry, trước tiên bạn cần tạo một repository.
Tạo repository trong Google Cloud Artifact Registry#
Mở trang Artifact Registry trong Google Cloud Console. Nếu sử dụng Artifact Registry lần đầu, bạn có thể được nhắc bật Artifact Registry API trước.
- Chọn Create Repository.
- Nhập tên repository. Chọn region mong muốn và sử dụng các thiết lập mặc định cho những tùy chọn khác, trừ khi bạn cần thay đổi cụ thể.
Việc chọn region có thể ảnh hưởng đến khả năng cung cấp machine và một số giới hạn compute đối với người dùng không phải Enterprise. Bạn có thể tìm thêm thông tin trong tài liệu chính thức của Vertex AI: quota và giới hạn của Vertex AI
- Sau khi repository được tạo, hãy lưu PROJECT_ID, Location (Region) và Repository Name vào secrets vault hoặc file
.env. Bạn sẽ cần các thông tin này sau để tag và push Docker image lên Artifact Registry.
Xác thực Docker với Artifact Registry#
Xác thực Docker client với repository Artifact Registry bạn vừa tạo. Chạy command sau trong terminal:
gcloud auth configure-docker YOUR_REGION-docker.pkg.devTag và push image lên Artifact Registry#
Tag và push Docker image lên Google Artifact Registry.
Bạn nên sử dụng tag duy nhất mỗi khi cập nhật image. Hầu hết dịch vụ GCP, bao gồm Vertex AI, đều dựa vào image tag để versioning và scaling tự động, vì vậy nên sử dụng semantic versioning hoặc tag dựa trên ngày tháng.
Tag image bằng URL của repository Artifact Registry. Thay các placeholder bằng những giá trị bạn đã lưu trước đó.
docker tag IMAGE_NAME:IMAGE_VERSION YOUR_REGION-docker.pkg.dev/YOUR_PROJECT_ID/YOUR_REPOSITORY_NAME/IMAGE_NAME:IMAGE_VERSIONPush image đã tag lên repository Artifact Registry.
docker push YOUR_REGION-docker.pkg.dev/YOUR_PROJECT_ID/YOUR_REPOSITORY_NAME/IMAGE_NAME:IMAGE_VERSIONChờ quá trình hoàn tất. Bây giờ bạn sẽ thấy image trong repository Artifact Registry.
Để xem hướng dẫn cụ thể hơn về cách làm việc với image trong Artifact Registry, hãy xem tài liệu Artifact Registry: Push và pull image.
4. Import model vào Vertex AI#
Với Docker image bạn vừa push, giờ đây bạn có thể import model vào Vertex AI.
- Trong menu điều hướng của Google Cloud, đi tới Vertex AI > Model Registry. Ngoài ra, bạn có thể tìm kiếm "Vertex AI" trong thanh tìm kiếm ở đầu Google Cloud Console.
5. Tạo Vertex AI Endpoint và triển khai model#
Theo thuật ngữ của Vertex AI, endpoint là các model đã triển khai, vì chúng đại diện cho các HTTP endpoint nơi bạn gửi inference request, trong khi model là các ML artifact đã training được lưu trữ trong Model Registry.
Để triển khai model, bạn cần tạo một Endpoint trong Vertex AI.
- Trong menu điều hướng Vertex AI, đi tới Endpoints. Chọn region bạn đã sử dụng khi import model. Nhấp vào Create.
Hãy nhớ rằng một số region có quota compute rất hạn chế, vì vậy bạn có thể không chọn được một số machine type hoặc GPU trong region của mình. Nếu đây là yếu tố quan trọng, hãy chuyển deployment sang region có quota lớn hơn. Tìm thêm thông tin trong tài liệu chính thức của Vertex AI: quota và giới hạn của Vertex AI.
- Sau khi chọn machine type, bạn có thể nhấp vào Continue. Tại thời điểm này, bạn có thể chọn bật model monitoring trong Vertex AI — một service bổ sung sẽ theo dõi performance của model và cung cấp insight về hành vi của model. Tính năng này là tùy chọn và phát sinh thêm chi phí, vì vậy hãy lựa chọn theo nhu cầu của bạn. Nhấp vào Create.
Vertex AI sẽ mất vài phút (tối đa 30 phút ở một số region) để triển khai model. Bạn sẽ nhận được email notification sau khi deployment hoàn tất.
6. Test model đã triển khai#
Sau khi deployment hoàn tất, Vertex AI sẽ cung cấp cho bạn một API interface mẫu để test model.
Để test remote inference, bạn có thể sử dụng cURL command được cung cấp hoặc tạo một Python client library khác để gửi request đến model đã triển khai. Hãy nhớ encode ảnh sang base64 trước khi gửi đến endpoint /predict.
Tương tự khi test local, hãy dự kiến request đầu tiên sẽ có độ trễ ngắn vì Ultralytics cần pull và load model YOLO26 trong container đang chạy.
Bạn đã triển khai thành công model YOLO26 được pretrained với Ultralytics trên Google Cloud Vertex AI.
FAQ#
Có; tuy nhiên, trước tiên bạn cần export model sang format tương thích với Vertex AI, chẳng hạn TensorFlow, Scikit-learn hoặc XGBoost. Google Cloud cung cấp hướng dẫn chạy model
.pttrên Vertex với tổng quan đầy đủ về quy trình chuyển đổi: Chạy model PyTorch trên Vertex AI.Lưu ý rằng setup sau cùng sẽ chỉ dựa vào standard serving layer của Vertex AI và không hỗ trợ các tính năng nâng cao của Ultralytics framework. Vì Vertex AI hỗ trợ đầy đủ các model đã containerize và có thể tự động scale chúng theo cấu hình deployment, dịch vụ cho phép bạn tận dụng đầy đủ khả năng của các model Ultralytics YOLO mà không cần chuyển đổi chúng sang format khác.
FastAPI cung cấp thông lượng cao cho các workload suy luận. Hỗ trợ async cho phép xử lý nhiều request đồng thời mà không chặn main thread, điều này rất quan trọng khi phục vụ các model thị giác máy tính.
Tính năng validation request/response tự động của FastAPI giúp giảm lỗi runtime trong các dịch vụ suy luận production. Điều này đặc biệt hữu ích đối với các API phát hiện đối tượng, nơi tính nhất quán của định dạng input là yếu tố then chốt.
FastAPI tạo thêm rất ít overhead tính toán cho pipeline suy luận, nhờ đó dành được nhiều tài nguyên hơn cho việc thực thi model và xử lý ảnh.
FastAPI cũng hỗ trợ SSE (Sự kiện do máy chủ gửi), rất hữu ích cho các kịch bản suy luận streaming.
Đây thực chất là một tính năng linh hoạt của Google Cloud Platform, trong đó bạn cần chọn region cho từng service mình sử dụng. Khi triển khai một model được đóng gói trong container trên Vertex AI, lựa chọn region quan trọng nhất là region cho Model Registry. Region này sẽ quyết định khả năng cung cấp các loại máy và quota cho quá trình triển khai model.
Ngoài ra, nếu bạn mở rộng thiết lập và lưu dữ liệu hoặc kết quả dự đoán trong Cloud Storage hoặc BigQuery, bạn cần sử dụng cùng region với Model Registry để giảm thiểu độ trễ và đảm bảo thông lượng cao khi truy cập dữ liệu.