I have received the mail from officials containing FalconTest.rar file. Please share the demo code to utilize this resource.
import json
url = URL
for i, row in tqdm(test_df.iterrows(), total=len(test_df), desc='Processing rows'):
question = row['question']
option1 = row['option 1']
option2 = row['option 2']
option3 = row['option 3']
option4 = row['option 4']
option5 = row['option 5']
category = row['category']
test_index = row['Test_Index']
results = timescale_retriever.get_relevant_documents(question)
query = TEST_DATASET_ALPACA_PROMPT.format(results, question, option1, option2, option3, option4, option5, category)
data = {
"inputs": query,
}
# Convert the dictionary to a JSON string
json_data = json.dumps(data)
# Set the appropriate headers for a JSON payload
headers = {
"Content-Type": "application/json"
try:
response = requests.post(url, data=json_data, headers=headers)
except Exception as e:
response = None
print("An error occurred:", e)
value = response.text["body"][0]["generated_text"]
answer_id = regex_query_response_postprocessor(value)
question_id = extract_question_id_from_test_df_index(test_index)
sample_submission_df = pd.concat([
sample_submission_df,
pd.DataFrame([{
'Question_ID': question_id,
'Answer_ID': answer_id,
'Task': 'Falcon 7.5B'
}])
], ignore_index=True)
import json
url = URL
for i, row in tqdm(test_df.iterrows(), total=len(test_df), desc='Processing rows'):
question = row['question']
option1 = row['option 1']
option2 = row['option 2']
option3 = row['option 3']
option4 = row['option 4']
option5 = row['option 5']
category = row['category']
test_index = row['Test_Index']
results = timescale_retriever.get_relevant_documents(question)
query = TEST_DATASET_ALPACA_PROMPT.format(results, question, option1, option2, option3, option4, option5, category)
data = {
"inputs": query,
}
# Convert the dictionary to a JSON string
json_data = json.dumps(data)
# Set the appropriate headers for a JSON payload
headers = {
"Content-Type": "application/json"
}
try:
response = requests.post(url, data=json_data, headers=headers)
except Exception as e:
response = None
print("An error occurred:", e)
value = response.text["body"][0]["generated_text"]
answer_id = regex_query_response_postprocessor(value)
question_id = extract_question_id_from_test_df_index(test_index)
sample_submission_df = pd.concat([
sample_submission_df,
pd.DataFrame([{
'Question_ID': question_id,
'Answer_ID': answer_id,
'Task': 'Falcon 7.5B'
}])
], ignore_index=True)