Roy Han 10 miesięcy temu
rodzic
commit
512e0a7bde
3 zmienionych plików z 0 dodań i 33 usunięć
  1. 0 5
      llm/ext_server/server.cpp
  2. 0 17
      llm/ext_server/utils.hpp
  3. 0 11
      server/routes.go

+ 0 - 5
llm/ext_server/server.cpp

@@ -1206,7 +1206,6 @@ struct llama_server_context
             res.result_json = json
             {
                 {"embedding", std::vector<float>(n_embd, 0.0f)},
-                {"truncated", slot.truncated}
             };
         }
         else
@@ -1224,7 +1223,6 @@ struct llama_server_context
                         res.result_json = json
                         {
                             {"embedding", std::vector<float>(n_embd, 0.0f)},
-                            {"truncated", slot.truncated}
                         };
                         continue;
                     }
@@ -1233,7 +1231,6 @@ struct llama_server_context
                 res.result_json = json
                 {
                     {"embedding", std::vector<float>(embd, embd + n_embd)},
-                    {"truncated", slot.truncated}
                 };
             }
         }
@@ -3063,7 +3060,6 @@ int main(int argc, char **argv) {
                 if (!json_value(data, "stream", false)) {
                     std::string completion_text;
                     task_result result = llama.queue_results.recv(task_id);
-                    LOG_INFO("completion", {{"result", result.result_json}});
                     if (!result.error && result.stop) {
                         res.set_content(result.result_json.dump(-1, ' ', false, json::error_handler_t::replace), "application/json; charset=utf-8");
                     }
@@ -3079,7 +3075,6 @@ int main(int argc, char **argv) {
                         while (true)
                         {
                             task_result result = llama.queue_results.recv(task_id);
-                            LOG_INFO("completion", {{"result", result.result_json}});
                             if (!result.error) {
                                 const std::string str =
                                     "data: " +

+ 0 - 17
llm/ext_server/utils.hpp

@@ -656,20 +656,3 @@ static json probs_vector_to_json(const llama_context *ctx, const std::vector<com
     }
     return out;
 }
-
-// // normalize a vector
-// static std::vector<float> normalize_vector(const std::vector<float>& vec, int size) {
-//     double sum = 0.0;
-//     for (float value : vec) {
-//         sum += value * value;
-//     }
-//     sum = std::sqrt(sum);
-
-//     const float norm = sum > 0.0 ? 1.0f / sum : 0.0f;
-
-//     std::vector<float> normalized_vec(size);
-//     for (int i = 0; i < size; i++) {
-//         normalized_vec[i] = vec[i] * norm;
-//     }
-//     return normalized_vec;
-// }

+ 0 - 11
server/routes.go

@@ -533,17 +533,6 @@ func (s *Server) EmbeddingsHandler(c *gin.Context) {
 		return
 	}
 
-	// assert that embedding is normalized
-	sum := 0.0
-	for _, v := range embedding {
-		sum += v * v
-	}
-	if math.Abs(sum-1) < 1e-6 {
-		slog.Info("embedding is normalized", "sum", sum)
-	} else {
-		slog.Info("embedding is not normalized", "sum", sum)
-	}
-
 	resp := api.EmbeddingResponse{
 		Embedding: embedding,
 	}