Download example.py from Connais/connais-1-68m: direct link, hf CLI and curl.
- Browser
- Download file 537 Bytes
-
https://huggingface.co/Connais/connais-1-68m/resolve/main/example.py
- Command line
-
hf download hf://Connais/connais-1-68m/example.py
-
curl -L -o example.py https://huggingface.co/Connais/connais-1-68m/resolve/main/example.py
537 Bytes
| """Load Connais 1 from this folder and answer one request. | |
| pip install . | |
| python example.py | |
| """ | |
| import json | |
| from pathlib import Path | |
| from connais import load_engine | |
| here = Path(__file__).parent | |
| engine = load_engine(here) # or load_engine("Connais/connais-1-68m") to fetch the files from the Hub | |
| request = json.loads((here / "examples" / "request.json").read_text()) | |
| response, timing = engine(request["state"], request["questions"]) | |
| print(json.dumps(response, indent=2)) | |
| print(f"{timing['wall_ms']:.1f} ms on {engine.device}") | |