def METHOD_NAME(use_gpu):
    if args.search_engine == "elastic":
        document_store_with_docs = ElasticsearchDocumentStore(
            host=args.host,
            port=args.port,
            username=args.username,
            password=args.password,
            embedding_dim=args.embedding_dim,
            vector_type="dense_vector",
            search_fields=["content", "meta"],
            index=args.root_index_name,
        )
    else:
        document_store_with_docs = BaiduElasticsearchDocumentStore(
            host=args.host,
            port=args.port,
            username=args.username,
            password=args.password,
            embedding_dim=args.embedding_dim,
            similarity="dot_prod",
            vector_type="bpack_vector",
            search_fields=["content", "meta"],
            index=args.root_index_name,
        )
    # 语义索引模型
    if args.model_type == "ernie-embedding-v1":
        dpr_retriever = EmbeddingRetriever(
            document_store=document_store_with_docs,
            retriever_batch_size=args.retriever_batch_size,
            api_key=args.embedding_api_key,
            embed_title=args.embed_title,
            secret_key=args.embedding_secret_key,
        )
    else:
        dpr_retriever = DensePassageRetriever(
            document_store=document_store_with_docs,
            query_embedding_model=args.query_embedding_model,
            passage_embedding_model=args.passage_embedding_model,
            params_path=args.params_path,
            output_emb_size=args.embedding_dim,
            max_seq_len_query=args.max_seq_len_query,
            max_seq_len_passage=args.max_seq_len_passage,
            batch_size=args.retriever_batch_size,
            use_gpu=use_gpu,
            embed_title=args.embed_title,
        )
    bm_retriever = BM25Retriever(document_store=document_store_with_docs)
    return dpr_retriever, bm_retriever