Download training/code/card_examples.py from SlayerLab/Slayer1B-1.10-Instruct-30.11: direct link, hf CLI and curl.
- Browser
- Download file 4.33 kB
-
https://huggingface.co/SlayerLab/Slayer1B-1.10-Instruct-30.11/resolve/main/training/code/card_examples.py
- Command line
-
hf download hf://SlayerLab/Slayer1B-1.10-Instruct-30.11/training/code/card_examples.py
-
curl -L -o card_examples.py https://huggingface.co/SlayerLab/Slayer1B-1.10-Instruct-30.11/resolve/main/training/code/card_examples.py
4.33 kB
| """Example conversations for the 30.11 model card: real tool execution through the Studio server (same harness as live_eval), greedy decoding. | |
| The 16 prompts were fixed before the model was run on them and every transcript is kept unedited. python card_examples.py CKPT OUT.json""" | |
| import json | |
| import os | |
| import sys | |
| from datetime import date | |
| from pathlib import Path | |
| import torch | |
| from tokenizers import Tokenizer | |
| import live_eval as L | |
| from chatfmt import Fmt | |
| from model_io import load | |
| W = L.WEB | |
| DOC = {"service_agreement.pdf": ["SERVICE AGREEMENT no. 7/2026\nClient: Golden Ear Bakery, 3 Mill Street, Torun.\nSubject: servicing of 4 convection ovens.", | |
| "4. Flat fee: PLN 1,250 net per month.\n5. Payment term: 14 days from delivery of the invoice.", | |
| "7. Fixed term of 24 months. 8. Notice period: 2 months."]} | |
| GROUP = [{"author": "Ola", "timestamp": "2026-11-27T09:00:00", "text": "I will finish the slides by Monday."}, | |
| {"author": "Bartek", "timestamp": "2026-11-27T09:02:00", "text": "I will order the brochures by Friday."}, | |
| {"author": "Iza", "timestamp": "2026-11-27T09:05:00", "text": "Wrap-up meeting on Wednesday at 15:30, room 2."}] | |
| S = [ | |
| ("chat", "Who are you", W + ["calculator"], "Hi! What's your name and who made you?", "en", {}), | |
| ("chat", "Writing, no tool needed", W + ["calculator", "get_weather"], "Write two short slogans for a small flower shop.", "en", {}), | |
| ("chat", "Polish to English", W + ["calculator"], "Przetłumacz na angielski: „Prosimy o potwierdzenie terminu dostawy do czwartku.”", "pl", {}), | |
| ("chat", "One-sentence explanation", W + ["calculator"], "Explain in one sentence what an API is.", "en", {}), | |
| ("tools", "Live exchange rate and maths", ["get_exchange_rate", "calculator", "web_search"], "How much is 40 euros in zlotys at today's NBP rate?", "en", {}), | |
| ("tools", "Weather right now, in Polish", ["get_weather", "web_search"], "Jaka jest teraz pogoda w Zakopanem?", "pl", {}), | |
| ("tools", "Exact percentage", ["calculator", "convert_units"], "What is 18% of 2450?", "en", {}), | |
| ("tools", "Live web search", W + ["calculator"], "Search the web and tell me which city hosted the 1964 Summer Olympics.", "en", {}), | |
| ("work", "Question about a document", ["search_document", "read_document", "web_search"], "What is the monthly fee and the notice period in my service agreement?", "en", {"docs": DOC}), | |
| ("work", "Saving a note", ["save_note", "create_table", "web_search"], "Save a note: pick up the parcel, call the accountant, buy printer ink.", "en", {}), | |
| ("work", "Reply to a client, in Polish", W + ["calculator"], "Klient pyta, kiedy dostanie fakturę. Napisz krótką, uprzejmą odpowiedź, że wyślemy ją jutro.", "pl", {}), | |
| ("work", "Comparing two offers", ["calculator", "web_search"], "Shop A: 15 chairs at 89 each. Shop B: 15 chairs at 95 each with a 10% discount. Which is cheaper and by how much?", "en", {}), | |
| ("hard", "Missing information", ["calculator", "convert_units", "web_search"], "Calculate my loan instalment.", "en", {}), | |
| ("hard", "Dead link", W + ["calculator"], "Read https://en.wikipedia.org/wiki/Royal_Castle_xyz_missing and tell me in which city the Royal Castle in Poland stands.", "en", {}), | |
| ("hard", "Group chat recap", ["search_messages", "create_table"], "@Slayer who is responsible for what, and by when?", "en", {"group": GROUP, "name": "Ola"}), | |
| ("hard", "Arithmetic without a tool", [], "What is 17 times 23?", "en", {}), | |
| ] | |
| if __name__ == "__main__": | |
| f = Fmt(Tokenizer.from_file(os.environ["SLAYER_TOKENIZER"])) | |
| model, _, _ = load(sys.argv[1], device="cuda", dtype=torch.bfloat16) | |
| model.eval() | |
| today, out = date.today().isoformat(), [] | |
| for g, t, tools, user, lang, ex in S: | |
| r = L.run_case(model, f, {"id": t, "lang": lang, "tools": tools, "user": user, "check": {}, **ex}, "http://127.0.0.1:5200", today) | |
| out.append({"group": g, "title": t, "lang": lang, "user": user, "tools": tools, "calls": r["trace"], "final": r["final"], "ckpt": sys.argv[1], "date": today}) | |
| print(t, "|", [c["call"]["name"] for c in r["trace"]], "|", repr(r["final"][:260]), flush=True) | |
| Path(sys.argv[2]).write_text(json.dumps(out, ensure_ascii=False, indent=1), encoding="utf-8") | |