You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have many gold reference target/label, but inputs in my case don't exist. Can DSPy do this? I want the few shots to be chosen at least based only on the right output/target distribution.
In DSPy, the Example objects have a with_inputs() method, which can mark specific fields as inputs. (The rest are just metadata or labels.)
but how does it know what is the label then?
Toy example
importdspy# Create an Example object# qa_pair = dspy.Example(question="This is a question?", answer="This is an answer.")qa_pair=dspy.Example(answer="This is an answer.")
# Specify the input field, leaving the answer as the output (label)# qa_pair_with_input = qa_pair.with_labels("answer")# print(qa_pair_with_input)print(qa_pair)
#%%# from dspy.datasets import HotPotQA# # Load the dataset# dataset = HotPotQA(train_seed=1, train_size=20, eval_seed=2023, dev_size=50, test_size=0)# # Tell DSPy that the 'question' field is the input and the 'answer' field is the label# trainset = [x.with_inputs('question').with_labels('answer') for x in dataset.train]# devset = [x.with_inputs('question').with_labels('answer') for x in dataset.dev]# len(trainset), len(devset)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have many gold reference target/label, but inputs in my case don't exist. Can DSPy do this? I want the few shots to be chosen at least based only on the right output/target distribution.
Docs say:
but how does it know what is the label then?
Toy example
Beta Was this translation helpful? Give feedback.
All reactions