How do I build a PRefLexOR that I can use with my own body of literature, and can I do…
- User
How do I build a PRefLexOR that I can use with my own body of literature, and can I do it locally on my machine?
Assistant
To build a PRefLexOR (Recursive Language Modeling for Exploratory Reasoning Optimization) that you can use with your own body of literature, and run it locally on your machine, follow these steps:
1. Set Up the Environment
- Install the required dependencies by running:
Thebash
pip install -r requirements.txtrequirements.txtfile includes packages liketorch,transformers,peft,trl, and others, which are essential for running PRefLexOR.
2. Prepare Your Literature Data
- You need to have your literature data indexed. The repository uses
llama-indexfor vector store retrieval. You can index your documents usingVectorIndexRetrieveras shown in theget_nodes_for_topicfunction inutils.py:pythonfrom llama_index.core.indices.vector_store.retrievers import VectorIndexRetriever def get_nodes_for_topic(index, topic, number_nodes_to_get=5): retriever = VectorIndexRetriever( index=index, similarity_top_k=number_nodes_to_get, vector_store_query_mode="default", ) nodes = retriever.retrieve(topic) concatenated_text = " ".join([node.text for node in nodes]) return nodes, concatenated_text - You can create your own index using
llama-indexor any other vector store that supports retrieval.
3. Initialize the PRefLexOR Trainer
- You can use either
PRefLexORDPOTrainerorPRefLexORORPOTrainerdepending on your preference. Both are defined inactive_trainer.py. - Here’s an example of initializing
PRefLexORDPOTrainer:python
- Install the required dependencies by running:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.