Instructions to use litert-community/decider-0.8b-LiteRT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/decider-0.8b-LiteRT with LiteRT-LM:
# LiteRT-LM runs on various platforms (Android, iOS, Windows, Linux, macOS, IoT, Web/WASM) # and supports many APIs (C++, Python, Kotlin, Swift, JavaScript, Flutter). # For platform-specific integration guides, please refer to the official developer website: # https://ai.google.dev/edge/litert-lm # To try LiteRT-LM, the easiest way is to use our CLI tool. # 1. Install the LiteRT-LM CLI tool: pip install -U litert-lm # 2. Download and run this model locally: # See: https://ai.google.dev/edge/litert-lm/cli # A single .litertlm file in the repo is picked automatically; otherwise the CLI asks which one to run # (or pass its name right after the repo id). litert-lm run \ --from-huggingface-repo=litert-community/decider-0.8b-LiteRT \ --prompt="Write me a poem"
- LiteRT
How to use litert-community/decider-0.8b-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
File size: 1,354 Bytes
8a443c6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | """Content-addressed, repository-local bundle unpacking for the reference readout."""
import subprocess
import sys
import tomllib
from pathlib import Path
from common import ROOT, sha256, write_json
def unpack_bundle(bundle):
bundle=Path(bundle).resolve()
digest=sha256(bundle)
folder=ROOT/'.cache/readout'/digest
marker=folder/'complete.json'
if not marker.exists():
if folder.exists():
raise RuntimeError(f'Incomplete bundle cache requires inspection: {folder}')
folder.parent.mkdir(parents=True,exist_ok=True)
command=[sys.executable,'-B',str(Path(sys.executable).parent/'litert-lm'),
'unpack',str(bundle),'--output-dir',str(folder)]
result=subprocess.run(command,capture_output=True,text=True)
log=ROOT/'.cache'/f'unpack_cache_{digest}.log'
log.parent.mkdir(parents=True,exist_ok=True)
log.write_text(result.stdout+result.stderr)
if result.returncode:raise RuntimeError(f'Bundle unpack failed: {log}')
write_json(marker,dict(bundle_sha256=digest,command=command,log=str(log.relative_to(ROOT))))
config=tomllib.loads((folder/'model.toml').read_text())
sections=[s for s in config['section'] if s['section_type']=='TFLiteModel']
assert len(sections)==1
return folder,folder/sections[0]['data_path'],config,digest
|