Use Dolly2.0 for Dataframe or Tabular Data.
I have a dataframe(df) and want to give the whole "df" as context to Dolly-7B model and ask any questions from that dataset - it can be simple calculations or insights or aggregation etc.
import torch
from transformers import pipeline
from langchain import PromptTemplate, LLMChain
from langchain.llms import HuggingFacePipeline
Load the dataframe
df = pd.read_csv("./Table.csv")
generate_text = pipeline(model="databricks/dolly-v2-7b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto", return_full_text=True)
hf_pipeline = HuggingFacePipeline(pipeline=generate_text)
I am new to language models, can anyone guide me how the code should be written further to ask questions to Dolly and it answer analyzing my dataframe.
Thanks in advance!!
This isn't what this type of text-gen model does. See the model card for how you feed natural-language questions to it. You can try passing some CSV data in your text as context with your question, but I doubt it will work as you imagine.