Closed TaeyoonKim-DS closed 1 year ago
I don't know if I understand what is asked here but wouldn't it be possible to use a json file of multiple examples to fit, like this one maybe https://github.com/promptslab/Promptify/blob/main/examples/data/binary.json
Then I think the model would be able to extract brand information from examples like your Two shot above or any other one with arbitrarily longer size and with the general domain knowledge it has should be able to extract any unseen brand as well.
@ewankim1023, as suggested by @eren23 Please check the examples. you can pass as many examples (shots) as you want using the example
parameter.
@ewankim1023 Here is an example code
You need to format the examples (shots) in [ (example, output) ] format, such as
examples = [("Among US Hat Cap Snapback Gift US Seller", {'T': 'Brand', 'E': 'Among US'}),
("[New Adhesion Series 5] Braun Mens Electric Shaver 50-R1200s", {'T': 'Brand', 'E': 'Braun'})]
# now giving a new sentence after a few short learning
new_input = "OnePlus phones are good for multitasking"
result = nlp_prompter.fit('ner.jinja',
domain = 'ecommerce',
text_input = new_input,
labels = ['Brand'],
examples = examples)
print(eval(result['text']))
Output:
[{'T': 'Brand', 'E': 'OnePlus'}]
This is an exciting model. How can I add few examples instead of one shot? I am trying to identify brand name from ecommerce product titles such as Amazon.
For example: One shot : Among US Hat Cap Snapback Gift US Seller BRAND, Among US Two shot: [New Adhesion Series 5] Braun Mens Electric Shaver 50-R1200s BRAND, Braun
Any way I can do this?
thanks