| 464 | self.active_update_id: Optional[str] = None |
| 465 | |
| 466 | def install( |
| 467 | self, |
| 468 | manifest: WeightUpdateManifest, |
| 469 | tensors: Mapping[str, torch.Tensor], |
| 470 | ) -> None: |
| 471 | WeightLayout.from_metadata(manifest.metadata).validate_supported() |
| 472 | tensor_map = dict(tensors) |
| 473 | if set(tensor_map) != set(manifest.tensors): |
| 474 | missing = sorted(set(manifest.tensors) - set(tensor_map)) |
| 475 | extra = sorted(set(tensor_map) - set(manifest.tensors)) |
| 476 | raise WeightManifestValidationError( |
| 477 | f"vLLM checkpoint reload tensor set mismatch: missing={missing}, extra={extra}" |
| 478 | ) |
| 479 | |
| 480 | weights_path = self._resolve_weights_path(manifest, tensor_map) |
| 481 | try: |
| 482 | reload_weights = self._resolve_reload_weights() |
| 483 | reload_weights(weights_path) |
| 484 | if self.synchronize_cuda and torch.cuda.is_available(): |
| 485 | torch.cuda.synchronize() |
| 486 | except Exception: |
| 487 | self.active_update_id = None |
| 488 | raise |
| 489 | |
| 490 | self.active_weight_version = manifest.weight_version |
| 491 | self.active_update_id = manifest.update_id |
| 492 | |
| 493 | def release(self, update_id: str) -> None: |
| 494 | if self.active_update_id == update_id: |