Skip to content

nanhhao04/SimpleModelParalleism-RabbitMQ

Repository files navigation

Dự án minh họa cách chia nhỏ mô hình AI (Model Parallelism) giữa hai thiết bị (hoặc hai tiến trình) —
mỗi thiết bị giữ một phần của mạng neural, giao tiếp qua RabbitMQ message broker.

Model Parallelism

  • Mô hình được chia tại điểm split_point thành 2 phần:
    • Device A (device1): xử lý input → tạo activation.
    • Device B (device2): nhận activation → tính output, loss, gradient.
  • Sau khi backward, Device2 gửi gradient ngược lại cho Device1.

RabbitMQ Communication

  • forward_queue: Device1 ➜ Device2 (activation + label)
  • backward_queue: Device2 ➜ Device1 (gradient)

Các bước thức hiện

1. Cài Python packages

pip install -r requirements.txt

2. Chạy RabbitMQ bằng Docker Compose

docker compose up -d

Chạy dự án

Mở 2 terminal riêng biệt:

Terminal 1 — Device 2 (nhận forward)

python device2.py

Terminal 2 — Device 1 (gửi forward)

python device1.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages