Spaces:
Runtime error
Runtime error
| use serde::{Serialize, Deserialize}; | |
| use bytes::Bytes; | |
| pub enum TensorDataType { | |
| F32, | |
| F16, | |
| BF16, | |
| Q4K, | |
| } | |
| pub struct SwarmTensor { | |
| pub dims: Vec<usize>, | |
| pub data_type: TensorDataType, | |
| pub data: Bytes, | |
| } | |
| pub struct TensorPacket { | |
| pub task_id: String, | |
| pub sequence_id: u64, | |
| pub source_node: String, | |
| pub target_node: String, | |
| pub layer_range: (usize, usize), | |
| pub hidden_states: SwarmTensor, | |
| } | |
| pub enum SwarmControlMessage { | |
| // Auth & Identity | |
| Hello { peer_id: String, backend: super::compute::BackendType }, | |
| JoinResponse { encrypted_cluster_key: Vec<u8> }, | |
| // Orchestration | |
| AssignLayers { start: usize, end: usize }, | |
| StatusUpdate { load: f32, vram_usage: u64 }, | |
| // Compute | |
| ForwardRequest(TensorPacket), | |
| ForwardResponse(TensorPacket), | |
| // Results | |
| StreamToken(String), | |
| TaskResult { | |
| task_id: String, | |
| logits: Vec<f32>, | |
| output_state: Bytes | |
| }, | |
| // Control | |
| Heartbeat, | |
| DrainRequest, | |
| } | |