Datasets:
Download lab/spot_check.py from HuggingFaceM4/reachy-gestures-data: direct link, hf CLI and curl.
- Browser
- Download file 2.19 kB
-
https://huggingface.co/datasets/HuggingFaceM4/reachy-gestures-data/resolve/main/lab/spot_check.py
- Command line
-
hf download hf://datasets/HuggingFaceM4/reachy-gestures-data/lab/spot_check.py
-
curl -L -o spot_check.py https://huggingface.co/datasets/HuggingFaceM4/reachy-gestures-data/resolve/main/lab/spot_check.py
2.19 kB
| """Show what a model does on a few fresh sentences I wrote by hand (not in any dataset): python spot_check.py <repo>""" | |
| import sys, runpy | |
| from pathlib import Path | |
| SENTENCES = [ | |
| ("react", "I finally got the job!!"), ("react", "my dog died yesterday"), ("react", "can you tell me what time it is"), | |
| ("react", "I'm not angry, just a bit tired"), ("react", "ugh, the train is late again"), ("react", "that's disgusting, there's a hair in my soup"), | |
| ("react", "thank you so much, that really helped"), ("react", "wait, what? you can dance?"), ("react", "I'm scared of the dark"), | |
| ("react", "um so like what's the weather tomorrow"), ("react", "je suis tellement content de te voir"), ("react", "estoy muy triste hoy"), | |
| ("react", "das ist ja unglaublich!"), ("react", "non mi piace per niente"), ("react", "今日はとても疲れた"), ("react", "phew, the test is over and I passed"), | |
| ("say", "Happy birthday! I hope it's a wonderful day."), ("say", "The capital of Australia is Canberra."), ("say", "I'm sorry, I don't know the answer to that."), | |
| ("say", "Hello there, welcome to the museum!"), ("say", "Hmm, let me think about that for a second."), ("say", "Oh no, that sounds really frustrating."), | |
| ("say", "Yes, absolutely!"), ("say", "Take a deep breath, everything is going to be okay."), ("say", "Wow, that's amazing news!"), | |
| ("say", "Ich verstehe, das ergibt Sinn."), ("say", "C'est une excellente question."), ("say", "No, I don't think that's a good idea."), | |
| ] | |
| ns: dict = {"__file__": str(Path("evaluate.py").resolve()), "__name__": "x"} | |
| exec(Path("evaluate.py").read_text().split("spec = sys.argv[1]")[0], ns) | |
| threshold = float(sys.argv[3]) if len(sys.argv) > 3 else 0.3 | |
| rows = [{"kind": k, "text": t} for k, t in SENTENCES] | |
| method, _, target = sys.argv[1].partition(":") | |
| if method == "lookup": | |
| preds, threshold = ns["lookup_predictor"](target)(rows), 0.6 | |
| else: | |
| sys.argv = ["evaluate.py", sys.argv[1], sys.argv[2]] | |
| preds = ns["head_predictor"]("onnx", target)(rows) | |
| for (kind, text), (move, p) in zip(SENTENCES, preds): | |
| got = move if move != "none" and p >= threshold else "-" | |
| print(f"{kind:5} {got:14} {p:.2f} {text}") | |