|
@@ -167,7 +167,7 @@ class ModelTrainer:
|
|
|
# 将 (1, 768) 的矩阵转换为 (768,) 的一维向量
|
|
|
vec1 = vec1.squeeze() # 形状从 (1, 768) 变为 (768,)
|
|
|
vec2 = vec2.squeeze() # 形状从 (1, 768) 变为 (768,)
|
|
|
- print(f"vec1 shape: {vec1.shape}, vec2 shape: {vec2.shape}")
|
|
|
+ # print(f"vec1 shape: {vec1.shape}, vec2 shape: {vec2.shape}")
|
|
|
# 计算余弦相似度
|
|
|
return np.dot(vec1, vec2) / (np.linalg.norm(vec1) * np.linalg.norm(vec2))
|
|
|
|
|
@@ -364,7 +364,7 @@ if __name__ == "__main__":
|
|
|
|
|
|
# 使用文件初始化方法 2025-3-11 成功验证支持windows
|
|
|
init_method = f'env://' # env:// # 文件路径需要所有进程都能访问
|
|
|
- dist.init_process_group(backend=backend, init_method=init_method)
|
|
|
+ # dist.init_process_group(backend=backend, init_method=init_method)
|
|
|
|
|
|
print(f"Initialized distributed training with backend: {backend}")
|
|
|
|