Instructions to use litert-community/d1-2B-LiteRT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/d1-2B-LiteRT with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
d1-2B for LiteRT: decision graphs at seven lengths, the eight-sequence and eight-signature files, seven picture towers, five SM8850 NPU files, the PyTorch-free host, the fixtures and the conversion scripts
df44977 verified Download conversion/make_subsets.py from litert-community/d1-2B-LiteRT: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/litert-community/d1-2B-LiteRT/resolve/main/conversion/make_subsets.py
- Command line
-
hf download hf://litert-community/d1-2B-LiteRT/conversion/make_subsets.py
-
curl -L -o make_subsets.py https://huggingface.co/litert-community/d1-2B-LiteRT/resolve/main/conversion/make_subsets.py
1.77 kB
| """The record sets of the eight-sequence graph's checks, chosen before any number: the reference-answered records whose | |
| every sequence fits a bucket (set/token_counts.json `longest`), and the chosen control arms | |
| (conversion/red_arms_chosen_arms.json, pick_arms.py) whose arm and base both fit it. | |
| python3 conversion/make_subsets.py -> conversion/ids_L128.json, conversion/red_arms_L128.json (and the same two | |
| files for L256, which no number on the card uses) | |
| """ | |
| import json | |
| import os | |
| WORK = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) | |
| def main(): | |
| tc = json.load(open(os.path.join(WORK, "set/token_counts.json"))) | |
| longest = {**{k: v.get("longest") for k, v in tc["records"].items()}, | |
| **{k: v.get("longest") for k, v in tc["arms"].items()}} | |
| ref = json.load(open(os.path.join(WORK, "out/ref/ref_fp32.json")))["records"] | |
| arms = json.load(open(os.path.join(WORK, "conversion/red_arms_chosen_arms.json"))) | |
| for L, d in ((256, "quant"), (128, "batch")): | |
| ids = sorted(k for k, r in ref.items() if not r.get("error") and (longest.get(k) or 10 ** 9) <= L) | |
| keep = [a for a in arms if (longest.get(a["id"]) or 10 ** 9) <= L and (longest.get(a["base_id"]) or 10 ** 9) <= L] | |
| json.dump({"what": f"reference-answered records whose every sequence is <= {L} tokens (chosen before any number)", | |
| "bucket": L, "count": len(ids), "ids": ids}, open(os.path.join(WORK, "conversion", f"ids_L{L}.json"), "w"), | |
| indent=0) | |
| json.dump(keep, open(os.path.join(WORK, "conversion", f"red_arms_L{L}.json"), "w"), indent=1) | |
| print(L, len(ids), [a["id"] for a in keep]) | |
| if __name__ == "__main__": | |
| main() | |