@@ -388,21 +388,19 @@ def launch(pipeline: CommonPipeline, iter_num: int, prompt_idx: int, iter_timest
388
388
def get_texts_from_file (args : dict ) -> list :
389
389
texts_list = []
390
390
if args ["rerank_texts_file" ] is not None and args ["rerank_texts" ] is not None :
391
- log . warning ( " --texts and --texts_file are set, they are conflict options, it will be used texts from --texts_file " )
391
+ raise RuntimeError ( "== --texts and --texts_file are set together , they define lists of texts both, please choose one of them == " )
392
392
393
393
if args ["rerank_texts_file" ] is not None :
394
394
for input_texts_file in args ["rerank_texts_file" ]:
395
- if input_texts_file .endswith (".jsonl" ):
396
- if os .path .exists (input_texts_file ):
397
- log .info (f"Read texts from { input_texts_file } " )
398
- with open (input_texts_file , "r" , encoding = "utf-8" ) as f :
399
- for line in f :
400
- data = json .loads (line )
401
- texts_list .append (data ["text" ])
402
- else :
403
- raise RuntimeError (f"== The texts file:{ input_texts_file } does not exist ==" )
404
- else :
395
+ if not input_texts_file .endswith (".jsonl" ):
405
396
raise RuntimeError (f"== The texts file:{ input_texts_file } should be ended with .jsonl ==" )
397
+ if not os .path .exists (input_texts_file ):
398
+ raise RuntimeError (f"== The texts file:{ input_texts_file } does not exist ==" )
399
+ log .info (f"Read texts from { input_texts_file } " )
400
+ with open (input_texts_file , "r" , encoding = "utf-8" ) as f :
401
+ for line in f :
402
+ data = json .loads (line )
403
+ texts_list .append (data ["text" ])
406
404
else :
407
405
if args ["rerank_texts" ] is not None :
408
406
texts_list = args ["rerank_texts" ]
0 commit comments