add unsloth code snippet
Browse files
app.py
CHANGED
|
@@ -111,6 +111,16 @@ masked_text = text_tokenizer.decode([mask if x == -100 else x for x in ids])
|
|
| 111 |
st.markdown("#### Masked Prompt ('x' is the mask token)")
|
| 112 |
st.code(masked_text, language="html")
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
st.markdown("#### You may share the following URL with others to show them the results")
|
| 115 |
url = f"https://zeel-twro.hf.space?model={model}&message={message}&instruction_part={instruction_part}&response_part={response_part}&chat_template_idx={chat_template_key}"
|
| 116 |
st.markdown(f"`{url}`")
|
|
|
|
| 111 |
st.markdown("#### Masked Prompt ('x' is the mask token)")
|
| 112 |
st.code(masked_text, language="html")
|
| 113 |
|
| 114 |
+
st.markdown("#### Your Unsloth code snippet")
|
| 115 |
+
code = f"""from unsloth.chat_templates import train_on_responses_only
|
| 116 |
+
trainer = train_on_responses_only(
|
| 117 |
+
trainer,
|
| 118 |
+
instruction_part = "{instruction_part}",
|
| 119 |
+
response_part = "{response_part}",
|
| 120 |
+
)
|
| 121 |
+
"""
|
| 122 |
+
st.code(code, language="python")
|
| 123 |
+
|
| 124 |
st.markdown("#### You may share the following URL with others to show them the results")
|
| 125 |
url = f"https://zeel-twro.hf.space?model={model}&message={message}&instruction_part={instruction_part}&response_part={response_part}&chat_template_idx={chat_template_key}"
|
| 126 |
st.markdown(f"`{url}`")
|