feat: 平台治理与权限体系完善,存储进度/GPU预留/审批中心与日志整合

- 平台治理: 租户用户权限层次、资源ACL、审批中心与审批模板、访问申请
- 存储: MinIO 存储进度迁移、对象存储安全加固与测试
- 计算: GPU 资源预留、compute 轮询与同步增强
- 权限: permission v2 迁移、权限安全验收测试
- 日志: 后端运行日志中文说明、操作日志整合
- 数据处理/评测: 数据转换与模型评测优化

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
wuyongtao
2026-08-21 09:49:48 +08:00
parent 080ef6ab00
commit 6f0e82f351
94 changed files with 9547 additions and 1045 deletions

View File

@@ -7,6 +7,28 @@ import uuid
from typing import Any, Iterator
def _ensure_peft_transformers_compat() -> None:
"""Bridge a removed PEFT helper used by the bundled Transformers build.
The offline Compute image currently contains Transformers 5.8.0 and PEFT
0.18.1. Transformers imports this private helper when a model directory
contains PEFT metadata, but PEFT 0.18.1 does not expose it. Evaluation
runs in single-process HuggingFace mode, so tensor-parallel sharding is
not applicable and a no-op compatibility hook is the correct behavior.
"""
try:
from peft.utils import save_and_load
except Exception:
return
if hasattr(save_and_load, "_maybe_shard_state_dict_for_tp"):
return
def _maybe_shard_state_dict_for_tp(_model: Any, _state_dict: dict[str, Any], _adapter_name: str) -> None:
return None
save_and_load._maybe_shard_state_dict_for_tp = _maybe_shard_state_dict_for_tp
class InferenceSession:
"""Manages a loaded model for inference with LLaMA-Factory ChatModel.
@@ -143,6 +165,7 @@ class InferenceSession:
args = dict(self._load_args)
infer_result = get_infer_args(args)
_ensure_peft_transformers_compat()
model = ChatModel(args)
tokenizer = getattr(model, "tokenizer", None) or model.engine.tokenizer
generating_args = infer_result[-1]
@@ -182,6 +205,7 @@ class InferenceSession:
self._loaded_at = time.time()
self._status = "ready"
def _release_model(self) -> None:
with self._chat_lock:
with self._state_lock: