async , not conflict
This commit is contained in:
@@ -78,6 +78,10 @@ class ElasticHelper:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async def get_document(self, index_name, id):
|
||||||
|
res = await self.es.get(index=index_name, id=id)
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------start---------------------------
|
# ----------------------------start---------------------------
|
||||||
# متد importBulkList:
|
# متد importBulkList:
|
||||||
@@ -89,7 +93,7 @@ class ElasticHelper:
|
|||||||
# - دادهها را به صورت bulk وارد میکند
|
# - دادهها را به صورت bulk وارد میکند
|
||||||
# - از helpers.bulk Elasticsearch استفاده میکند
|
# - از helpers.bulk Elasticsearch استفاده میکند
|
||||||
# -----------------------------end----------------------------
|
# -----------------------------end----------------------------
|
||||||
async def data_pars(self, listData, index_name):
|
async def data_pars_import(self, listData, index_name):
|
||||||
for item in listData:
|
for item in listData:
|
||||||
yield(
|
yield(
|
||||||
{
|
{
|
||||||
@@ -99,11 +103,22 @@ class ElasticHelper:
|
|||||||
"_source": item["_source"],
|
"_source": item["_source"],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def data_pars_update(self, listData, index_name):
|
||||||
|
for item in listData:
|
||||||
|
yield(
|
||||||
|
{
|
||||||
|
"_op_type": "update",
|
||||||
|
"_index": index_name,
|
||||||
|
"_id": item["_id"],
|
||||||
|
"doc": item["_source"],
|
||||||
|
}
|
||||||
|
)
|
||||||
async def importBulkList(self, listData, index_name):
|
async def importBulkList(self, listData, index_name):
|
||||||
try:
|
try:
|
||||||
await async_bulk(
|
await async_bulk(
|
||||||
client=self.es,
|
client=self.es,
|
||||||
actions=self.data_pars(listData, index_name),
|
actions=self.data_pars_import(listData, index_name),
|
||||||
raise_on_error=True,
|
raise_on_error=True,
|
||||||
raise_on_exception=True,
|
raise_on_exception=True,
|
||||||
)
|
)
|
||||||
@@ -121,7 +136,7 @@ class ElasticHelper:
|
|||||||
try:
|
try:
|
||||||
await async_bulk(
|
await async_bulk(
|
||||||
client=self.es,
|
client=self.es,
|
||||||
actions=self.data_pars(listData, index_name),
|
actions=self.data_pars_update(listData, index_name),
|
||||||
raise_on_error=raise_on_error,
|
raise_on_error=raise_on_error,
|
||||||
raise_on_exception=raise_on_exception,
|
raise_on_exception=raise_on_exception,
|
||||||
yield_ok=yield_ok,
|
yield_ok=yield_ok,
|
||||||
|
|||||||
@@ -332,11 +332,11 @@ dict_version_weight = {
|
|||||||
|
|
||||||
load_dotenv(dotenv_path="config.env")
|
load_dotenv(dotenv_path="config.env")
|
||||||
|
|
||||||
host = os.getenv("HOST_160")
|
# host = os.getenv("HOST_160")
|
||||||
password = os.getenv("HOST_160_PASS")
|
# password = os.getenv("HOST_160_PASS")
|
||||||
|
|
||||||
# host = os.getenv("HOST_112")
|
host = os.getenv("HOST_112")
|
||||||
# password = os.getenv("HOST_112_PASS")
|
password = os.getenv("HOST_112_PASS")
|
||||||
|
|
||||||
|
|
||||||
# host = os.getenv("HOST_H102")
|
# host = os.getenv("HOST_H102")
|
||||||
@@ -540,8 +540,6 @@ body_test1={
|
|||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
## -----------------------------------------------------------------------
|
|
||||||
## -----------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -276,7 +276,16 @@ dict_version_weight = {
|
|||||||
"deepseek": 1,
|
"deepseek": 1,
|
||||||
"qwopus4_6": 1,
|
"qwopus4_6": 1,
|
||||||
"qwen3_5_122B": 1,
|
"qwen3_5_122B": 1,
|
||||||
"openyourmind": 1,
|
"qwen3_80B": 1,
|
||||||
|
|
||||||
|
"gemma4_103": 1,
|
||||||
|
"deepseek_103": 1,
|
||||||
|
"oss120_103": 1,
|
||||||
|
"qwen3_5_103": 1,
|
||||||
|
"qwen3_6_103": 1,
|
||||||
|
"qwen3_103": 1,
|
||||||
|
"qwopus4_6_103": 1,
|
||||||
|
"yourmind_103": 1,
|
||||||
},
|
},
|
||||||
"conflict_detections" : {
|
"conflict_detections" : {
|
||||||
"oss120": 0.8,
|
"oss120": 0.8,
|
||||||
@@ -285,7 +294,18 @@ dict_version_weight = {
|
|||||||
"deepseek": 1,
|
"deepseek": 1,
|
||||||
"qwopus4_6": 1,
|
"qwopus4_6": 1,
|
||||||
"qwen3_5_122B": 1,
|
"qwen3_5_122B": 1,
|
||||||
|
"qwen3_80B": 1,
|
||||||
"openyourmind": 1.2,
|
"openyourmind": 1.2,
|
||||||
|
|
||||||
|
"gemma4_103": 1,
|
||||||
|
"deepseek_103": 1,
|
||||||
|
"oss120_103": 1,
|
||||||
|
"qwen3_5_103": 1,
|
||||||
|
"qwen3_6_103": 1,
|
||||||
|
"qwen3_103": 1,
|
||||||
|
"qwopus4_6_103": 1,
|
||||||
|
"yourmind_103": 1,
|
||||||
|
|
||||||
},
|
},
|
||||||
"relation_identifications" : {
|
"relation_identifications" : {
|
||||||
"oss120": 0.8,
|
"oss120": 0.8,
|
||||||
@@ -294,7 +314,18 @@ dict_version_weight = {
|
|||||||
"deepseek": 1,
|
"deepseek": 1,
|
||||||
"qwopus4_6": 1,
|
"qwopus4_6": 1,
|
||||||
"qwen3_5_122B": 1,
|
"qwen3_5_122B": 1,
|
||||||
|
"qwen3_80B": 1,
|
||||||
"openyourmind": 1,
|
"openyourmind": 1,
|
||||||
|
|
||||||
|
"gemma4_103": 1,
|
||||||
|
"deepseek_103": 1,
|
||||||
|
"oss120_103": 1,
|
||||||
|
"qwen3_5_103": 1,
|
||||||
|
"qwen3_6_103": 1,
|
||||||
|
"qwen3_103": 1,
|
||||||
|
"qwopus4_6_103": 1,
|
||||||
|
"yourmind_103": 1,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -333,8 +364,7 @@ elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
|||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
version_keys_v3 = [
|
version_keys_v3 = [
|
||||||
"su-gemma4_cd-ri-urmind_e-qwen3.6_285k_group_v3",
|
"su-gemma4_cd-ri-urmind_e-qwen3.6_285k_group_v3"
|
||||||
"su-gemma4_cd-ri-urmind_e-qwen3.6_285k_group_v3-2",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
@@ -361,8 +391,23 @@ C_avg_cd = -1.0745626235324917
|
|||||||
C_avg_rt = 0.3602568006054728
|
C_avg_rt = 0.3602568006054728
|
||||||
# C_avg_rt = 0.30
|
# C_avg_rt = 0.30
|
||||||
|
|
||||||
|
body_103={
|
||||||
|
"query": {
|
||||||
|
"nested": {
|
||||||
|
"path": "subject_unitys",
|
||||||
|
"query": {
|
||||||
|
"term": {
|
||||||
|
"subject_unitys.ref_key": {
|
||||||
|
"value": "gemma4_103"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
body_not={
|
|
||||||
|
body_no_rank={
|
||||||
"query": {
|
"query": {
|
||||||
"bool": {
|
"bool": {
|
||||||
"must":[
|
"must":[
|
||||||
@@ -370,16 +415,6 @@ body_not={
|
|||||||
"terms": {
|
"terms": {
|
||||||
"version_key": version_keys_v3
|
"version_key": version_keys_v3
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"nested": {
|
|
||||||
"path": "conflict_evaluations",
|
|
||||||
"query": {
|
|
||||||
"exists": {
|
|
||||||
"field": "conflict_evaluations.main_type"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"must_not": [
|
"must_not": [
|
||||||
@@ -395,8 +430,9 @@ body_not={
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# re_compute_conflict_ranks(elastic, "mj_qa_conflict", C_avg_su, C_avg_cd, C_avg_rt, 3, body_not)
|
# re_compute_conflict_ranks(elastic, "mj_qa_conflict", C_avg_su, C_avg_cd, C_avg_rt, 3, body_103)
|
||||||
re_compute_conflict_ranks(elastic, "mj_qa_conflict", C_avg_su, C_avg_cd, C_avg_rt, 3, body_v3)
|
re_compute_conflict_ranks(elastic, "mj_qa_conflict", C_avg_su, C_avg_cd, C_avg_rt, 3, body_no_rank)
|
||||||
|
# re_compute_conflict_ranks(elastic, "mj_qa_conflict", C_avg_su, C_avg_cd, C_avg_rt, 3, body_v3)
|
||||||
|
|
||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -913,11 +913,11 @@ def getRate(main_type):
|
|||||||
|
|
||||||
load_dotenv(dotenv_path="config.env")
|
load_dotenv(dotenv_path="config.env")
|
||||||
|
|
||||||
host = os.getenv("HOST_160")
|
# host = os.getenv("HOST_160")
|
||||||
password = os.getenv("HOST_160_PASS")
|
# password = os.getenv("HOST_160_PASS")
|
||||||
|
|
||||||
# host = os.getenv("HOST_112")
|
host = os.getenv("HOST_112")
|
||||||
# password = os.getenv("HOST_112_PASS")
|
password = os.getenv("HOST_112_PASS")
|
||||||
|
|
||||||
|
|
||||||
print(".... majles_codes_update_steps ......", host)
|
print(".... majles_codes_update_steps ......", host)
|
||||||
@@ -1166,7 +1166,6 @@ elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
|||||||
# ref_key="yourmind-p3")
|
# ref_key="yourmind-p3")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# # #----------------------------------------------------------------------------------------------
|
# # #----------------------------------------------------------------------------------------------
|
||||||
# # #----------------------------------------------------------------------------------------------
|
# # #----------------------------------------------------------------------------------------------
|
||||||
# # #----------------------------------------------------------------------------------------------
|
# # #----------------------------------------------------------------------------------------------
|
||||||
@@ -1177,4 +1176,4 @@ elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
|||||||
|
|
||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
# .\.env\Scripts\activate
|
# .\.env\Scripts\activate
|
||||||
# python -m app.majles.majles_conflict_works
|
# python -m app.majles.majles_conflict_works_v2
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import numbers
|
import numbers
|
||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from elasticsearch import Elasticsearch, helpers
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import zipfile
|
import zipfile
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import asyncio
|
||||||
|
import multiprocessing
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
|
||||||
|
|
||||||
from app.common.elastic_helper import ElasticHelper
|
from app.common.elastic_helper_async import ElasticHelper
|
||||||
from app.common.general_functions import *
|
from app.common.general_functions import *
|
||||||
from app.common.text_normalizer import TextNormalizer
|
from app.common.text_normalizer import TextNormalizer
|
||||||
from app.common.data_helper import DataHelper
|
from app.common.data_helper import DataHelper
|
||||||
@@ -47,6 +47,137 @@ def get_evaluation_data(data):
|
|||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def run_to_procssing(list_files, index_name, file_jumps, host, password):
|
||||||
|
results = []
|
||||||
|
for file in list_files:
|
||||||
|
result = asyncio.run( async_import_data_from_json( file, index_name, file_jumps, host, password))
|
||||||
|
results.append(result)
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
async def async_pack_files_to_elastic(
|
||||||
|
input_path, index_name, file_jumps, host, password
|
||||||
|
):
|
||||||
|
|
||||||
|
list_files = []
|
||||||
|
if os.path.isdir(input_path):
|
||||||
|
list_files = [
|
||||||
|
os.path.join(input_path, f)
|
||||||
|
for f in os.listdir(input_path)
|
||||||
|
if os.path.isfile(os.path.join(input_path, f))
|
||||||
|
]
|
||||||
|
elif os.path.isfile(input_path):
|
||||||
|
list_files.append(input_path)
|
||||||
|
|
||||||
|
jump_files = []
|
||||||
|
if os.path.exists(file_jumps):
|
||||||
|
with open(file_jumps, "r", encoding="utf-8") as f:
|
||||||
|
jump_files = [line.strip() for line in f if line.strip()]
|
||||||
|
|
||||||
|
list_input = []
|
||||||
|
for file in list_files:
|
||||||
|
if not file in jump_files:
|
||||||
|
list_input.append(file)
|
||||||
|
|
||||||
|
# ----------------------------------------
|
||||||
|
# ---- packing by cpu_count --------------
|
||||||
|
cpu_count = 8
|
||||||
|
list_process = []
|
||||||
|
|
||||||
|
x = len(list_input)
|
||||||
|
y = (x - (x % cpu_count)) / cpu_count
|
||||||
|
c = x % cpu_count
|
||||||
|
list_spilt = []
|
||||||
|
for f in range(0, x, int(y)):
|
||||||
|
list_spilt.append(f)
|
||||||
|
list_spilt[len(list_spilt) - 1] = list_spilt[len(list_spilt) - 1] + c
|
||||||
|
b = 0
|
||||||
|
len_list_spilt = len(list_spilt)
|
||||||
|
for split in list_spilt:
|
||||||
|
if b + 1 < len_list_spilt:
|
||||||
|
|
||||||
|
print( " pack = ", split, list_spilt[b + 1] , " of total= ", len(list_input))
|
||||||
|
proc = multiprocessing.Process(
|
||||||
|
target=run_to_procssing,
|
||||||
|
args=(
|
||||||
|
list_input[split : list_spilt[b + 1]],
|
||||||
|
index_name,
|
||||||
|
file_jumps,
|
||||||
|
host,
|
||||||
|
password,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
proc.start()
|
||||||
|
list_process.append(proc)
|
||||||
|
b = b + 1
|
||||||
|
for proc in list_process:
|
||||||
|
proc.join()
|
||||||
|
print("finish ⏹️✅")
|
||||||
|
|
||||||
|
def convert_import_data_to_es(item, jump_ids=None):
|
||||||
|
_id = item["id"]
|
||||||
|
|
||||||
|
if jump_ids is not None :
|
||||||
|
if _id in jump_ids:
|
||||||
|
return {}
|
||||||
|
jump_ids.append(_id)
|
||||||
|
|
||||||
|
previous_info = item["previous_info"]
|
||||||
|
next_info = item["next_info"]
|
||||||
|
version_key = item["version_key"]
|
||||||
|
subject_unity = item["subject_unity"]
|
||||||
|
|
||||||
|
if subject_unity["main_type"] == "no":
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
qanon_title1 = previous_info["qanon_title"]
|
||||||
|
qanon_id1 = previous_info["qanon_id"]
|
||||||
|
|
||||||
|
qanon_title2 = next_info["qanon_title"]
|
||||||
|
qanon_id2 = next_info["qanon_id"]
|
||||||
|
|
||||||
|
title_type1 = getTitleType(qanon_title1)
|
||||||
|
title_type2 = getTitleType(qanon_title2)
|
||||||
|
|
||||||
|
previous_info["title_type"] = title_type1
|
||||||
|
next_info["title_type"] = title_type2
|
||||||
|
|
||||||
|
conflict_detection = item["conflict_detection"]
|
||||||
|
# conflict_type_detection = item["conflict_type_detection"]
|
||||||
|
conflict_relation_identification = item["conflict_relation_type"]
|
||||||
|
conflict_evaluation = item["conflict_evaluation"]
|
||||||
|
conflict_final = item["conflict_final"]
|
||||||
|
|
||||||
|
subject_unity["ref_key"] = "gemma4"
|
||||||
|
|
||||||
|
es_data = {
|
||||||
|
"id": _id,
|
||||||
|
"version_key": version_key,
|
||||||
|
"previous_info": previous_info,
|
||||||
|
"next_info": next_info,
|
||||||
|
"subject_unitys": [subject_unity],
|
||||||
|
}
|
||||||
|
if conflict_detection:
|
||||||
|
conflict_detection["ref_key"] = "openyourmind"
|
||||||
|
es_data["conflict_detections"] = [conflict_detection]
|
||||||
|
|
||||||
|
if conflict_relation_identification:
|
||||||
|
conflict_relation_identification["ref_key"] = "openyourmind"
|
||||||
|
es_data["conflict_relation_identifications"] = [
|
||||||
|
conflict_relation_identification
|
||||||
|
]
|
||||||
|
|
||||||
|
if conflict_evaluation:
|
||||||
|
conflict_evaluation["ref_key"] = "qwen3-6"
|
||||||
|
es_data["conflict_evaluations"] = [conflict_evaluation]
|
||||||
|
|
||||||
|
if conflict_final:
|
||||||
|
es_data["conflict_finals"] = [conflict_final]
|
||||||
|
|
||||||
|
return es_data
|
||||||
|
|
||||||
|
|
||||||
def import_conflict_to_elastic(input_path, out_put_index_name, file_jump_ids):
|
def import_conflict_to_elastic(input_path, out_put_index_name, file_jump_ids):
|
||||||
|
|
||||||
jump_ids = []
|
jump_ids = []
|
||||||
@@ -97,65 +228,9 @@ def import_conflict_to_elastic(input_path, out_put_index_name, file_jump_ids):
|
|||||||
|
|
||||||
for item in data_all:
|
for item in data_all:
|
||||||
|
|
||||||
_id = item["id"]
|
es_data = convert_import_data_to_es(item, jump_ids)
|
||||||
|
|
||||||
if _id in jump_ids:
|
|
||||||
continue
|
|
||||||
|
|
||||||
jump_ids.append(_id)
|
|
||||||
|
|
||||||
previous_info = item["previous_info"]
|
|
||||||
next_info = item["next_info"]
|
|
||||||
version_key = item["version_key"]
|
|
||||||
subject_unity = item["subject_unity"]
|
|
||||||
|
|
||||||
if subject_unity["main_type"] == "no":
|
|
||||||
continue
|
|
||||||
|
|
||||||
qanon_title1 = previous_info["qanon_title"]
|
|
||||||
qanon_id1 = previous_info["qanon_id"]
|
|
||||||
|
|
||||||
qanon_title2 = next_info["qanon_title"]
|
|
||||||
qanon_id2 = next_info["qanon_id"]
|
|
||||||
|
|
||||||
title_type1 = getTitleType(qanon_title1)
|
|
||||||
title_type2 = getTitleType(qanon_title2)
|
|
||||||
|
|
||||||
previous_info["title_type"] = title_type1
|
|
||||||
next_info["title_type"] = title_type2
|
|
||||||
|
|
||||||
conflict_detection = item["conflict_detection"]
|
|
||||||
# conflict_type_detection = item["conflict_type_detection"]
|
|
||||||
conflict_relation_identification = item["conflict_relation_type"]
|
|
||||||
conflict_evaluation = item["conflict_evaluation"]
|
|
||||||
conflict_final = item["conflict_final"]
|
|
||||||
|
|
||||||
subject_unity["ref_key"] = "gemma4"
|
|
||||||
|
|
||||||
es_data = {
|
|
||||||
"id": _id,
|
|
||||||
"version_key": version_key,
|
|
||||||
"previous_info": previous_info,
|
|
||||||
"next_info": next_info,
|
|
||||||
"subject_unitys": [subject_unity],
|
|
||||||
}
|
|
||||||
if conflict_detection:
|
|
||||||
conflict_detection["ref_key"] = "openyourmind"
|
|
||||||
es_data["conflict_detections"] = [conflict_detection]
|
|
||||||
|
|
||||||
if conflict_relation_identification:
|
|
||||||
conflict_relation_identification["ref_key"] = "openyourmind"
|
|
||||||
es_data["conflict_relation_identifications"] = [
|
|
||||||
conflict_relation_identification
|
|
||||||
]
|
|
||||||
|
|
||||||
if conflict_evaluation:
|
|
||||||
conflict_evaluation["ref_key"] = "qwen3-6"
|
|
||||||
es_data["conflict_evaluations"] = [conflict_evaluation]
|
|
||||||
|
|
||||||
if conflict_final:
|
|
||||||
es_data["conflict_finals"] = [conflict_final]
|
|
||||||
|
|
||||||
|
if es_data :
|
||||||
bulk_data.append({"_id": _id, "_source": es_data})
|
bulk_data.append({"_id": _id, "_source": es_data})
|
||||||
|
|
||||||
if len(bulk_data) > 200:
|
if len(bulk_data) > 200:
|
||||||
@@ -189,129 +264,86 @@ def import_conflict_to_elastic(input_path, out_put_index_name, file_jump_ids):
|
|||||||
f.write("\n".join(jump_ids))
|
f.write("\n".join(jump_ids))
|
||||||
|
|
||||||
|
|
||||||
def append_conflict_to_elastic(
|
async def async_import_data_from_json(file, index_name, file_jumps, host, password) -> list:
|
||||||
elastic,
|
|
||||||
input_path,
|
|
||||||
out_put_index_name,
|
|
||||||
ref_key,
|
|
||||||
fields=[
|
|
||||||
"subject_unity",
|
|
||||||
"conflict_detection",
|
|
||||||
"relation_identification",
|
|
||||||
"conflict_evaluation",
|
|
||||||
"conflict_final",
|
|
||||||
"llm_output",
|
|
||||||
],
|
|
||||||
ref_key_advance={},
|
|
||||||
import_if_not_found=False,
|
|
||||||
):
|
|
||||||
list_files = []
|
|
||||||
if os.path.isdir(input_path):
|
|
||||||
list_files = [
|
|
||||||
os.path.join(input_path, f)
|
|
||||||
for f in os.listdir(input_path)
|
|
||||||
if os.path.isfile(os.path.join(input_path, f))
|
|
||||||
]
|
|
||||||
elif os.path.isfile(input_path):
|
|
||||||
list_files.append(input_path)
|
|
||||||
|
|
||||||
for file in list_files:
|
time = datetime.datetime.now().timestamp()
|
||||||
|
file_name = file.split("/")[-1:][0]
|
||||||
|
print("▶️", file_name)
|
||||||
|
|
||||||
|
elastic = ElasticHelper(
|
||||||
|
es_url=host, es_pass=password, es_user="elastic"
|
||||||
|
)
|
||||||
data_all = []
|
data_all = []
|
||||||
try:
|
try:
|
||||||
data_all = DataHelper.load_orjson(file)
|
with open(file, "rb") as rfile:
|
||||||
|
data_all = json.loads(rfile.read())
|
||||||
|
if data_all[0] and isinstance(data_all[0], list):
|
||||||
|
data_all = data_all[0]
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("********** error read data file json ", file, str(e))
|
print(f"not read file {file}", str(e))
|
||||||
continue
|
|
||||||
|
|
||||||
print("@" * 5, "file start...", file)
|
|
||||||
list_notfound = []
|
|
||||||
bulk_data = []
|
bulk_data = []
|
||||||
bulk_data_import = []
|
|
||||||
failed_data = []
|
failed_data = []
|
||||||
total_count = 0
|
total_count = 0
|
||||||
|
list_jump = []
|
||||||
for item in data_all:
|
for item in data_all:
|
||||||
|
es_data = convert_import_data_to_es(item)
|
||||||
|
if es_data:
|
||||||
|
bulk_data.append({"_id": _id, "_source": es_data})
|
||||||
|
|
||||||
_id = item["id"]
|
if len(bulk_data) > 200:
|
||||||
|
await elastic.importBulkList(bulk_data, index_name)
|
||||||
|
bulk_data = []
|
||||||
|
|
||||||
# if _id == "qs2489164_v2-9.qs2365626_v2-7":
|
if len(bulk_data) > 0:
|
||||||
# print("qs2489164_v2-9.qs2365626_v2-7")
|
await elastic.importBulkList(bulk_data, index_name)
|
||||||
|
|
||||||
import_state = False
|
bulk_data = []
|
||||||
_source = {}
|
|
||||||
res = None
|
|
||||||
try:
|
|
||||||
res = elastic.get_document(out_put_index_name, _id)
|
|
||||||
except:
|
|
||||||
list_notfound.append(_id)
|
|
||||||
if not import_if_not_found:
|
|
||||||
continue
|
|
||||||
|
|
||||||
import_state = True
|
|
||||||
version_key = item["version_key"]
|
|
||||||
|
|
||||||
previous_info = item["previous_info"]
|
with open(file_jumps, "a", encoding="utf-8") as f:
|
||||||
qanon_title1 = previous_info["qanon_title"]
|
f.write(file + "\n")
|
||||||
qanon_id1 = previous_info["qanon_id"]
|
|
||||||
|
|
||||||
next_info = item["next_info"]
|
# total_import += total_count
|
||||||
qanon_title2 = next_info["qanon_title"]
|
await elastic.es.close()
|
||||||
qanon_id2 = next_info["qanon_id"]
|
time1 = datetime.datetime.now().timestamp()
|
||||||
|
time = time1 - time
|
||||||
|
print("✅", file_name, ":", time)
|
||||||
|
|
||||||
title_type1 = getTitleType(qanon_title1)
|
|
||||||
title_type2 = getTitleType(qanon_title2)
|
|
||||||
conflict_tags = []
|
|
||||||
if qanon_id1 == qanon_id2:
|
|
||||||
conflict_tags.append("هم قانون")
|
|
||||||
|
|
||||||
previous_info["title_type"] = title_type1
|
|
||||||
next_info["title_type"] = title_type2
|
|
||||||
|
|
||||||
_source = {
|
def convert_append_data_ro_es(_source, item) :
|
||||||
"previous_info": previous_info,
|
|
||||||
"next_info": next_info,
|
|
||||||
"conflict_tags": conflict_tags,
|
|
||||||
"version_key": version_key,
|
|
||||||
"subject_unitys": [],
|
|
||||||
"conflict_detections": [],
|
|
||||||
"conflict_type_detections": [],
|
|
||||||
"conflict_relation_identifications": [],
|
|
||||||
"conflict_evaluations": [],
|
|
||||||
"conflict_finals": [],
|
|
||||||
}
|
|
||||||
res = {"_id": id, "_source": _source}
|
|
||||||
|
|
||||||
# print("id start...", _id)
|
|
||||||
|
|
||||||
subject_unitys = (
|
subject_unitys = (
|
||||||
res["_source"]["subject_unitys"]
|
_source["subject_unitys"]
|
||||||
if "subject_unitys" in res["_source"]
|
if "subject_unitys" in _source
|
||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
conflict_detections = (
|
conflict_detections = (
|
||||||
res["_source"]["conflict_detections"]
|
_source["conflict_detections"]
|
||||||
if "conflict_detections" in res["_source"]
|
if "conflict_detections" in _source
|
||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
conflict_type_detections = (
|
conflict_type_detections = (
|
||||||
res["_source"]["conflict_type_detections"]
|
_source["conflict_type_detections"]
|
||||||
if "conflict_type_detections" in res["_source"]
|
if "conflict_type_detections" in _source
|
||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
conflict_relation_identifications = (
|
conflict_relation_identifications = (
|
||||||
res["_source"]["conflict_relation_identifications"]
|
_source["conflict_relation_identifications"]
|
||||||
if "conflict_relation_identifications" in res["_source"]
|
if "conflict_relation_identifications" in _source
|
||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
conflict_evaluations = (
|
conflict_evaluations = (
|
||||||
res["_source"]["conflict_evaluations"]
|
_source["conflict_evaluations"]
|
||||||
if "conflict_evaluations" in res["_source"]
|
if "conflict_evaluations" in _source
|
||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
conflict_finals = (
|
conflict_finals = (
|
||||||
res["_source"]["conflict_finals"]
|
_source["conflict_finals"]
|
||||||
if "conflict_finals" in res["_source"]
|
if "conflict_finals" in _source
|
||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -589,6 +621,106 @@ def append_conflict_to_elastic(
|
|||||||
conflict_finals.append(item["conflict_final"])
|
conflict_finals.append(item["conflict_final"])
|
||||||
data["conflict_finals"] = conflict_finals
|
data["conflict_finals"] = conflict_finals
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def append_conflict_to_elastic(
|
||||||
|
elastic,
|
||||||
|
input_path,
|
||||||
|
out_put_index_name,
|
||||||
|
ref_key,
|
||||||
|
fields=[
|
||||||
|
"subject_unity",
|
||||||
|
"conflict_detection",
|
||||||
|
"relation_identification",
|
||||||
|
"conflict_evaluation",
|
||||||
|
"conflict_final",
|
||||||
|
"llm_output",
|
||||||
|
],
|
||||||
|
ref_key_advance={},
|
||||||
|
import_if_not_found=False,
|
||||||
|
):
|
||||||
|
list_files = []
|
||||||
|
if os.path.isdir(input_path):
|
||||||
|
list_files = [
|
||||||
|
os.path.join(input_path, f)
|
||||||
|
for f in os.listdir(input_path)
|
||||||
|
if os.path.isfile(os.path.join(input_path, f))
|
||||||
|
]
|
||||||
|
elif os.path.isfile(input_path):
|
||||||
|
list_files.append(input_path)
|
||||||
|
|
||||||
|
for file in list_files:
|
||||||
|
|
||||||
|
data_all = []
|
||||||
|
try:
|
||||||
|
data_all = DataHelper.load_orjson(file)
|
||||||
|
except Exception as e:
|
||||||
|
print("********** error read data file json ", file, str(e))
|
||||||
|
continue
|
||||||
|
|
||||||
|
print("@" * 5, "file start...", file)
|
||||||
|
list_notfound = []
|
||||||
|
bulk_data = []
|
||||||
|
bulk_data_import = []
|
||||||
|
failed_data = []
|
||||||
|
total_count = 0
|
||||||
|
|
||||||
|
for item in data_all:
|
||||||
|
|
||||||
|
_id = item["id"]
|
||||||
|
|
||||||
|
# if _id == "qs2489164_v2-9.qs2365626_v2-7":
|
||||||
|
# print("qs2489164_v2-9.qs2365626_v2-7")
|
||||||
|
|
||||||
|
import_state = False
|
||||||
|
_source = {}
|
||||||
|
res = None
|
||||||
|
try:
|
||||||
|
res = elastic.get_document(out_put_index_name, _id)
|
||||||
|
_source = res["_source"]
|
||||||
|
except:
|
||||||
|
list_notfound.append(_id)
|
||||||
|
if not import_if_not_found:
|
||||||
|
continue
|
||||||
|
|
||||||
|
import_state = True
|
||||||
|
version_key = item["version_key"]
|
||||||
|
|
||||||
|
previous_info = item["previous_info"]
|
||||||
|
qanon_title1 = previous_info["qanon_title"]
|
||||||
|
qanon_id1 = previous_info["qanon_id"]
|
||||||
|
|
||||||
|
next_info = item["next_info"]
|
||||||
|
qanon_title2 = next_info["qanon_title"]
|
||||||
|
qanon_id2 = next_info["qanon_id"]
|
||||||
|
|
||||||
|
title_type1 = getTitleType(qanon_title1)
|
||||||
|
title_type2 = getTitleType(qanon_title2)
|
||||||
|
conflict_tags = []
|
||||||
|
if qanon_id1 == qanon_id2:
|
||||||
|
conflict_tags.append("هم قانون")
|
||||||
|
|
||||||
|
previous_info["title_type"] = title_type1
|
||||||
|
next_info["title_type"] = title_type2
|
||||||
|
|
||||||
|
_source = {
|
||||||
|
"previous_info": previous_info,
|
||||||
|
"next_info": next_info,
|
||||||
|
"conflict_tags": conflict_tags,
|
||||||
|
"version_key": version_key,
|
||||||
|
"subject_unitys": [],
|
||||||
|
"conflict_detections": [],
|
||||||
|
"conflict_type_detections": [],
|
||||||
|
"conflict_relation_identifications": [],
|
||||||
|
"conflict_evaluations": [],
|
||||||
|
"conflict_finals": [],
|
||||||
|
}
|
||||||
|
res = {"_id": id, "_source": _source}
|
||||||
|
|
||||||
|
# print("id start...", _id)
|
||||||
|
data = convert_append_data_ro_es(_source, item)
|
||||||
|
|
||||||
if import_state:
|
if import_state:
|
||||||
data["id"] = _id
|
data["id"] = _id
|
||||||
data["previous_info"] = _source["previous_info"]
|
data["previous_info"] = _source["previous_info"]
|
||||||
@@ -625,6 +757,144 @@ def append_conflict_to_elastic(
|
|||||||
bulk_data = []
|
bulk_data = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async def async_append_conflict_to_elastic(
|
||||||
|
host, password,
|
||||||
|
input_path,
|
||||||
|
out_put_index_name,
|
||||||
|
ref_key,
|
||||||
|
fields=[
|
||||||
|
"subject_unity",
|
||||||
|
"conflict_detection",
|
||||||
|
"relation_identification",
|
||||||
|
"conflict_evaluation",
|
||||||
|
"conflict_final",
|
||||||
|
"llm_output",
|
||||||
|
],
|
||||||
|
ref_key_advance={},
|
||||||
|
import_if_not_found=False,
|
||||||
|
):
|
||||||
|
list_files = []
|
||||||
|
if os.path.isdir(input_path):
|
||||||
|
list_files = [
|
||||||
|
os.path.join(input_path, f)
|
||||||
|
for f in os.listdir(input_path)
|
||||||
|
if os.path.isfile(os.path.join(input_path, f))
|
||||||
|
]
|
||||||
|
elif os.path.isfile(input_path):
|
||||||
|
list_files.append(input_path)
|
||||||
|
|
||||||
|
|
||||||
|
elastic = ElasticHelper( es_url=host, es_pass=password, es_user="elastic")
|
||||||
|
|
||||||
|
for file in list_files:
|
||||||
|
|
||||||
|
data_all = []
|
||||||
|
try:
|
||||||
|
data_all = DataHelper.load_orjson(file)
|
||||||
|
except Exception as e:
|
||||||
|
print("********** error read data file json ", file, str(e))
|
||||||
|
continue
|
||||||
|
|
||||||
|
print("@" * 5, "file start...", file)
|
||||||
|
list_notfound = []
|
||||||
|
bulk_data = []
|
||||||
|
bulk_data_import = []
|
||||||
|
failed_data = []
|
||||||
|
total_count = 0
|
||||||
|
|
||||||
|
for item in data_all:
|
||||||
|
_id = item["id"]
|
||||||
|
# if _id == "qs2489164_v2-9.qs2365626_v2-7":
|
||||||
|
# print("qs2489164_v2-9.qs2365626_v2-7")
|
||||||
|
|
||||||
|
import_state = False
|
||||||
|
_source = {}
|
||||||
|
res = None
|
||||||
|
try:
|
||||||
|
res = await elastic.get_document(out_put_index_name, _id)
|
||||||
|
_source = res["_source"]
|
||||||
|
except Exception as e:
|
||||||
|
print( " Exception ", str(e))
|
||||||
|
list_notfound.append(_id)
|
||||||
|
if not import_if_not_found:
|
||||||
|
continue
|
||||||
|
|
||||||
|
import_state = True
|
||||||
|
version_key = item["version_key"]
|
||||||
|
|
||||||
|
previous_info = item["previous_info"]
|
||||||
|
qanon_title1 = previous_info["qanon_title"]
|
||||||
|
qanon_id1 = previous_info["qanon_id"]
|
||||||
|
|
||||||
|
next_info = item["next_info"]
|
||||||
|
qanon_title2 = next_info["qanon_title"]
|
||||||
|
qanon_id2 = next_info["qanon_id"]
|
||||||
|
|
||||||
|
title_type1 = getTitleType(qanon_title1)
|
||||||
|
title_type2 = getTitleType(qanon_title2)
|
||||||
|
conflict_tags = []
|
||||||
|
if qanon_id1 == qanon_id2:
|
||||||
|
conflict_tags.append("هم قانون")
|
||||||
|
|
||||||
|
previous_info["title_type"] = title_type1
|
||||||
|
next_info["title_type"] = title_type2
|
||||||
|
|
||||||
|
_source = {
|
||||||
|
"previous_info": previous_info,
|
||||||
|
"next_info": next_info,
|
||||||
|
"conflict_tags": conflict_tags,
|
||||||
|
"version_key": version_key,
|
||||||
|
"subject_unitys": [],
|
||||||
|
"conflict_detections": [],
|
||||||
|
"conflict_type_detections": [],
|
||||||
|
"conflict_relation_identifications": [],
|
||||||
|
"conflict_evaluations": [],
|
||||||
|
"conflict_finals": [],
|
||||||
|
}
|
||||||
|
res = {"_id": id, "_source": _source}
|
||||||
|
|
||||||
|
# print("id start...", _id)
|
||||||
|
data = convert_append_data_ro_es(_source, item)
|
||||||
|
|
||||||
|
if import_state:
|
||||||
|
data["id"] = _id
|
||||||
|
data["previous_info"] = _source["previous_info"]
|
||||||
|
data["next_info"] = _source["next_info"]
|
||||||
|
data["conflict_tags"] = _source["conflict_tags"]
|
||||||
|
data["version_key"] = _source["version_key"]
|
||||||
|
bulk_data_import.append({"_id": _id, "_source": data})
|
||||||
|
elif data:
|
||||||
|
bulk_data.append({"_id": _id, "_source": data})
|
||||||
|
|
||||||
|
if len(bulk_data_import) > 200:
|
||||||
|
total_count += len(bulk_data_import)
|
||||||
|
print("=!" * 10, " import to_elastic , total=" + str(total_count))
|
||||||
|
await elastic.importBulkList(bulk_data_import, out_put_index_name)
|
||||||
|
bulk_data_import = []
|
||||||
|
|
||||||
|
if len(bulk_data) > 200:
|
||||||
|
total_count += len(bulk_data)
|
||||||
|
print("=" * 10, "to_elastic , total=" + str(total_count))
|
||||||
|
await elastic.updateBulkList(bulk_data, out_put_index_name)
|
||||||
|
bulk_data = []
|
||||||
|
# break
|
||||||
|
|
||||||
|
if len(bulk_data_import) > 0:
|
||||||
|
total_count += len(bulk_data_import)
|
||||||
|
print("=!" * 10, " import to_elastic , total=" + str(total_count))
|
||||||
|
await elastic.importBulkList(bulk_data_import, out_put_index_name)
|
||||||
|
bulk_data_import = []
|
||||||
|
|
||||||
|
if len(bulk_data) > 0:
|
||||||
|
total_count += len(bulk_data)
|
||||||
|
print("=" * 10, "to_elastic , total=" + str(total_count))
|
||||||
|
await elastic.updateBulkList(bulk_data, out_put_index_name)
|
||||||
|
bulk_data = []
|
||||||
|
|
||||||
|
await elastic.es.close()
|
||||||
|
|
||||||
|
|
||||||
def clear_array_object_by(array, ref_key):
|
def clear_array_object_by(array, ref_key):
|
||||||
array = [c for c in array if c["ref_key"] != ref_key]
|
array = [c for c in array if c["ref_key"] != ref_key]
|
||||||
|
|
||||||
@@ -944,8 +1214,10 @@ def getRate(main_type):
|
|||||||
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
|
# .\.env\Scripts\activate
|
||||||
|
# python -m app.majles.majles_conflict_works_async_v3
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
load_dotenv(dotenv_path="config.env")
|
load_dotenv(dotenv_path="config.env")
|
||||||
|
|
||||||
host = os.getenv("HOST_160")
|
host = os.getenv("HOST_160")
|
||||||
@@ -954,55 +1226,168 @@ password = os.getenv("HOST_160_PASS")
|
|||||||
# host = os.getenv("HOST_112")
|
# host = os.getenv("HOST_112")
|
||||||
# password = os.getenv("HOST_112_PASS")
|
# password = os.getenv("HOST_112_PASS")
|
||||||
|
|
||||||
|
|
||||||
print(".... host ......", host)
|
print(".... host ......", host)
|
||||||
|
|
||||||
path_base_map = "G:/Project2/tavasi_160/src/repo/_other/"
|
## ----------------------------------------------------
|
||||||
elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
## ----------------------------------------------------
|
||||||
|
# path_base_map = "G:/Project2/tavasi_160/src/repo/_other/"
|
||||||
|
# elastic = ElasticHelper(es_url=f"http://{host}:6900",es_pass= password,es_user= "elastic", path_mappings=path_base_map)
|
||||||
|
|
||||||
|
# map_file = "G:/Project2/tavasi_160/src/repo/_other/majles/mj_qa_conflict.json"
|
||||||
|
# elastic.createIndex(index_name="mj_qa_conflict",map_name="mj_qa_conflict",mapping_file_path=map_file)
|
||||||
|
# elastic.es.close()
|
||||||
|
|
||||||
|
## ----------------------------------------------------
|
||||||
|
## ----------------------------------------------------
|
||||||
|
# #--- درج اطلاعات پایه 285 هزارتایی نسخه 3
|
||||||
|
# #--- مواردی که گما4 وحدت موضوعی تشخیص داده است
|
||||||
|
# #--- v3_base_285k
|
||||||
## ----------------------------------------------------
|
## ----------------------------------------------------
|
||||||
# input_path = r"G:\Project2\102_gpu\v3_conflict\285k_group_v3"
|
# input_path = r"G:\Project2\102_gpu\v3_conflict\285k_group_v3"
|
||||||
# file_jump_ids = r"G:\Project2\102_gpu\v3_conflict\285k_group_v3_jump_ids.json"
|
# file_jumps = r"G:\Project2\102_gpu\v3_conflict\285k_group_v3_jump_files.json"
|
||||||
# import_conflict_to_elastic(input_path, "mj_qa_conflict", file_jump_ids)
|
|
||||||
|
##---- not async ------
|
||||||
|
# ## import_conflict_to_elastic(input_path, "mj_qa_conflict", file_jumps)
|
||||||
|
|
||||||
|
# asyncio.run(
|
||||||
|
# async_pack_files_to_elastic(
|
||||||
|
# input_path, "mj_qa_conflict", file_jumps, host, password
|
||||||
|
# )
|
||||||
|
# )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------
|
## -----------------------------------------------------------------------
|
||||||
|
## -----------------------------------------------------------------------
|
||||||
|
## ---- 103 --> 102 مورد تست
|
||||||
|
## -----------------------------------------------------------------------
|
||||||
|
## -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# fields=[
|
||||||
|
# "subject_unity",
|
||||||
|
# "conflict_detection",
|
||||||
|
# "conflict_relation_type",
|
||||||
|
# "conflict_evaluation"
|
||||||
|
# ]
|
||||||
|
# append_conflict_to_elastic( elastic,
|
||||||
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\100_sample_285k\gemma4_103\start.json",
|
||||||
|
# out_put_index_name="mj_qa_conflict",
|
||||||
|
# ref_key="gemma4_103",
|
||||||
|
# fields=fields,
|
||||||
|
# )
|
||||||
|
|
||||||
# append_conflict_to_elastic( elastic,
|
# append_conflict_to_elastic( elastic,
|
||||||
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\100_sample_285k\DeepSeek_32B_103\start.json",
|
||||||
|
# out_put_index_name="mj_qa_conflict",
|
||||||
|
# ref_key="deepseek_103",
|
||||||
|
# fields=fields
|
||||||
|
# )
|
||||||
|
|
||||||
|
# append_conflict_to_elastic( elastic,
|
||||||
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\100_sample_285k\oss120b_103\start.json",
|
||||||
|
# out_put_index_name="mj_qa_conflict",
|
||||||
|
# ref_key="oss120_103",
|
||||||
|
# fields=fields
|
||||||
|
# )
|
||||||
|
|
||||||
|
# append_conflict_to_elastic( elastic,
|
||||||
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\100_sample_285k\Qwen3_5_122B_103\start.json",
|
||||||
|
# out_put_index_name="mj_qa_conflict",
|
||||||
|
# ref_key="qwen3_5_103",
|
||||||
|
# fields=fields
|
||||||
|
# )
|
||||||
|
|
||||||
|
# append_conflict_to_elastic( elastic,
|
||||||
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\100_sample_285k\Qwen3_6_35B_103\start.json",
|
||||||
|
# out_put_index_name="mj_qa_conflict",
|
||||||
|
# ref_key="qwen3_6_103",
|
||||||
|
# fields=fields
|
||||||
|
# )
|
||||||
|
|
||||||
|
# append_conflict_to_elastic( elastic,
|
||||||
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\100_sample_285k\Qwen3_80B_103\start.json",
|
||||||
|
# out_put_index_name="mj_qa_conflict",
|
||||||
|
# ref_key="qwen3_103",
|
||||||
|
# fields=fields
|
||||||
|
# )
|
||||||
|
|
||||||
|
# append_conflict_to_elastic( elastic,
|
||||||
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\100_sample_285k\Qwopus4_6_27B_103\start.json",
|
||||||
|
# out_put_index_name="mj_qa_conflict",
|
||||||
|
# ref_key="qwopus4_6_103",
|
||||||
|
# fields=fields
|
||||||
|
# )
|
||||||
|
|
||||||
|
|
||||||
|
# append_conflict_to_elastic( elastic,
|
||||||
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\100_sample_285k\yourmind_103\start.json",
|
||||||
|
# out_put_index_name="mj_qa_conflict",
|
||||||
|
# ref_key="yourmind_103",
|
||||||
|
# fields=fields
|
||||||
|
# )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ----------------------------------------------------
|
||||||
|
## ----------------------------------------------------
|
||||||
|
# #--- افزودن ارزیابی 17 هزارتایی جدید با مدلهای مختلف
|
||||||
|
## -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# asyncio.run(
|
||||||
|
# async_append_conflict_to_elastic( host, password,
|
||||||
# input_path=r"G:\Project2\102_gpu\v3_conflict\17K_ev_gemma4\finall_data_finall_gemma4.json",
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\17K_ev_gemma4\finall_data_finall_gemma4.json",
|
||||||
# out_put_index_name="mj_qa_conflict",
|
# out_put_index_name="mj_qa_conflict",
|
||||||
# ref_key="gemma4",
|
# ref_key="gemma4",
|
||||||
# fields=["conflict_evaluation"])
|
# fields=["conflict_evaluation"])
|
||||||
|
# )
|
||||||
|
|
||||||
# append_conflict_to_elastic( elastic,
|
# asyncio.run(
|
||||||
|
# async_append_conflict_to_elastic( host, password,
|
||||||
# input_path=r"G:\Project2\102_gpu\v3_conflict\17K_ev_oss120b\finall_data_finall_oss120b.json",
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\17K_ev_oss120b\finall_data_finall_oss120b.json",
|
||||||
# out_put_index_name="mj_qa_conflict",
|
# out_put_index_name="mj_qa_conflict",
|
||||||
# ref_key="oss120",
|
# ref_key="oss120",
|
||||||
# fields=["conflict_evaluation"])
|
# fields=["conflict_evaluation"])
|
||||||
|
# )
|
||||||
|
|
||||||
# append_conflict_to_elastic( elastic,
|
|
||||||
|
# asyncio.run(
|
||||||
|
# async_append_conflict_to_elastic( host, password,
|
||||||
# input_path=r"G:\Project2\102_gpu\v3_conflict\17K_ev_DeepSeek\finall_data_finall_DeepSeek.json",
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\17K_ev_DeepSeek\finall_data_finall_DeepSeek.json",
|
||||||
# out_put_index_name="mj_qa_conflict",
|
# out_put_index_name="mj_qa_conflict",
|
||||||
# ref_key="deepseek",
|
# ref_key="deepseek",
|
||||||
# fields=["conflict_evaluation"])
|
# fields=["conflict_evaluation"])
|
||||||
|
|
||||||
# append_conflict_to_elastic( elastic,
|
# )
|
||||||
|
|
||||||
|
|
||||||
|
# asyncio.run(
|
||||||
|
# async_append_conflict_to_elastic( host, password,
|
||||||
# input_path=r"G:\Project2\102_gpu\v3_conflict\17k_ev_Qwen3_5_122B\finall_data_finall_Qwen3_5_122B.json",
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\17k_ev_Qwen3_5_122B\finall_data_finall_Qwen3_5_122B.json",
|
||||||
# out_put_index_name="mj_qa_conflict",
|
# out_put_index_name="mj_qa_conflict",
|
||||||
# ref_key="qwen3_5_122B",
|
# ref_key="qwen3_5_122B",
|
||||||
# fields=["conflict_evaluation"])
|
# fields=["conflict_evaluation"])
|
||||||
|
# )
|
||||||
|
|
||||||
# append_conflict_to_elastic( elastic,
|
|
||||||
|
# asyncio.run(
|
||||||
|
# async_append_conflict_to_elastic( host, password,
|
||||||
# input_path=r"G:\Project2\102_gpu\v3_conflict\17k_ev_Qwopus4_6\finall_data_finall_Qwopus4_6.json",
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\17k_ev_Qwopus4_6\finall_data_finall_Qwopus4_6.json",
|
||||||
# out_put_index_name="mj_qa_conflict",
|
# out_put_index_name="mj_qa_conflict",
|
||||||
# ref_key="qwopus4_6",
|
# ref_key="qwopus4_6",
|
||||||
# fields=["conflict_evaluation"])
|
# fields=["conflict_evaluation"])
|
||||||
|
|
||||||
## -----------------------------------------------------------------------
|
# )
|
||||||
## -----------------------------------------------------------------------
|
|
||||||
## -----------------------------------------------------------------------
|
|
||||||
## -----------------------------------------------------------------------
|
# asyncio.run(
|
||||||
## -----------------------------------------------------------------------
|
# async_append_conflict_to_elastic( host, password,
|
||||||
# .\.env\Scripts\activate
|
# input_path=r"G:\Project2\102_gpu\v3_conflict\17k_ev_Qwen3_80B\finall_data_finall_Qwen3_80B.json",
|
||||||
# python -m app.majles.majles_conflict_works_v3
|
# out_put_index_name="mj_qa_conflict",
|
||||||
|
# ref_key="qwen3_80B",
|
||||||
|
# fields=["conflict_evaluation"])
|
||||||
|
|
||||||
|
# )
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user