Hi everyone,
For the Lab 1 coding assignment, can someone offer/provide examples from a syntax point of view before running the cell and evaluating the results?
I understand the theory and objectives but my syntax is leading to errors.
Please suggest unrelated examples or ideas to help understand the syntax. Perhaps there is a related resource that can clarify everything?
Here is a location where this would come in handy:
“for i, index in enumerate(example_indices):\n”,
" dialogue = dataset[‘test’][index][‘dialogue’]\n",
" summary = dataset[‘test’][index][‘summary’]\n",
" \n",
" prompt = f"""\n",
“Dialogue:\n”,
“\n”,
“{dialogue}\n”,
“\n”,
“What was going on?\n”,
“"""\n”,
“\n”,
I was able to avoid error messages by changing the wording within the following:
prompt = f"""
What time does the train come?
{dialogue}
Summary:
"""
I’m still trying to figure out examples of what could be included within a prompt even in a totally different example. I’m sure this would be helpful to most.
We could try different prompts and get different results.
For e.g., in Section 3.2, you can change the code to below:
for i, index in enumerate(example_indices):
dialogue = dataset['test'][index]['dialogue']
summary = dataset['test'][index]['summary']
prompt = f"""
Dialogue:
{dialogue}
What time does the train come?
"""
inputs = tokenizer(prompt, return_tensors='pt')
output = tokenizer.decode(
model.generate(
inputs["input_ids"],
max_new_tokens=50,
)[0],
skip_special_tokens=True
)
print(dash_line)
print('Example ', i + 1)
print(dash_line)
print(f'INPUT PROMPT:\n{prompt}')
print(dash_line)
print(f'BASELINE HUMAN SUMMARY:\n{summary}\n')
print(dash_line)
print(f'MODEL GENERATION - ZERO SHOT:\n{output}\n')
and the FLAN-T5 model tries its best to answer the prompt with the following:
---------------------------------------------------------------------------------------------------
Example 1
---------------------------------------------------------------------------------------------------
INPUT PROMPT:
Dialogue:
#Person1#: What time is it, Tom?
#Person2#: Just a minute. It's ten to nine by my watch.
#Person1#: Is it? I had no idea it was so late. I must be off now.
#Person2#: What's the hurry?
#Person1#: I must catch the nine-thirty train.
#Person2#: You've plenty of time yet. The railway station is very close. It won't take more than twenty minutes to get there.
What time does the train come?
---------------------------------------------------------------------------------------------------
BASELINE HUMAN SUMMARY:
#Person1# is in a hurry to catch a train. Tom tells #Person1# there is plenty of time.
---------------------------------------------------------------------------------------------------
MODEL GENERATION - ZERO SHOT:
The train comes at 9:30.