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
to you handsome guys.
the prompt in this demo maybe not working as the author said, the output is excessive because of bad format of the prompt, as mentioned here, and i followed that answer, using huggingface-chat-template, and the output is ok.
below is my solution.
>>>messages= [
... {"role": "system", "content": "Convert the following SQL written in Oracle dialect to MySQL dialect. only SQL is allowed in response"},
... {"role": "user", "content": "SELECT col1, TRUNC (col2/20) 'c2', TO_DATE(SYSDATE) 'c3' FROM ttt WHERE col3=4"},
... ]
>>>>>>>>>tokenized_chat=tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
>>>print(tokenizer.decode(tokenized_chat[0]))
<s> [INST] <<SYS>>ConvertthefollowingSQLwritteninOracledialecttoMySQLdialect. onlySQLisallowedinresponse<</SYS>>SELECTcol1, TRUNC (col2/20) 'c2', TO_DATE(SYSDATE) 'c3'FROMtttWHEREcol3=4 [/INST]
>>>outputs=model.generate(tokenized_chat, max_new_tokens=1280)
Theattentionmaskandthepadtokenidwerenotset. Asaconsequence, youmayobserveunexpectedbehavior. Pleasepassyourinput's`attention_mask`toobtainreliableresults.
Setting`pad_token_id`to`eos_token_id`:Noneforopen-endgeneration.
>>>print(tokenizer.decode(outputs[0]))
<s> [INST] <<SYS>>ConvertthefollowingSQLwritteninOracledialecttoMySQLdialect. onlySQLisallowedinresponse<</SYS>>SELECTcol1, TRUNC (col2/20) 'c2', TO_DATE(SYSDATE) 'c3'FROMtttWHEREcol3=4 [/INST] SELECTcol1, TRUNC(col2/20) ASc2, CURDATE() ASc3FROMtttWHEREcol3=4;</s>
The text was updated successfully, but these errors were encountered:
to you handsome guys.
the prompt in this demo maybe not working as the author said, the output is excessive because of bad format of the prompt, as mentioned here, and i followed that answer, using huggingface-chat-template, and the output is ok.
below is my solution.
The text was updated successfully, but these errors were encountered: