소스 검색

duplicate token_embd to output

Michael Yang 1 개월 전
부모
커밋
6b0486c216
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      ml/backend/ggml/ggml.go

+ 3 - 0
ml/backend/ggml/ggml.go

@@ -240,6 +240,9 @@ func New(r *os.File, params ml.BackendParams) (ml.Backend, error) {
 		switch {
 		switch {
 		case contains(t.Name, "position_embd", "token_embd", "token_norm_embd", "token_types"):
 		case contains(t.Name, "position_embd", "token_embd", "token_norm_embd", "token_types"):
 			createTensor(tensor{source: t}, input.bts)
 			createTensor(tensor{source: t}, input.bts)
+			if _, ok := meta.Tensors().GroupLayers()["output"]; !ok && t.Name == "token_embd.weight" {
+				createTensor(tensor{source: t, target: "output.weight"}, output.bts)
+			}
 		case contains(t.Name, "cls", "output", "output_norm"):
 		case contains(t.Name, "cls", "output", "output_norm"):
 			createTensor(tensor{source: t}, output.bts)
 			createTensor(tensor{source: t}, output.bts)
 		case strings.HasPrefix(t.Name, "v.") || strings.HasPrefix(t.Name, "mm."):
 		case strings.HasPrefix(t.Name, "v.") || strings.HasPrefix(t.Name, "mm."):