Text Classification
Transformers
Safetensors
Laya
minimal
snapshot
english-checkpoint
fine-tuning
french
Instructions to use PIXMELT/laya with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PIXMELT/laya with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="PIXMELT/laya")# pip install -U transformers accelerate # Load model directly from transformers import LayaTypedDecisions model = LayaTypedDecisions.from_pretrained("PIXMELT/laya", device_map="auto") - Laya
How to use PIXMELT/laya with Laya:
# 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
Download test.py from PIXMELT/laya: direct link, hf CLI and curl.
- Browser
- Download file 1.89 kB
-
https://huggingface.co/PIXMELT/laya/resolve/main/test.py
- Command line
-
hf download hf://PIXMELT/laya/test.py
-
curl -L -o test.py https://huggingface.co/PIXMELT/laya/resolve/main/test.py
1.89 kB
| import os | |
| os.environ["HF_HUB_OFFLINE"] = "1" | |
| import warnings | |
| warnings.filterwarnings("ignore", message="laya: this checkpoint ships temperatures") | |
| import laya | |
| import time | |
| # Load current model | |
| agent = laya.load(".") | |
| # Content | |
| article = "By 2031, artificial intelligences no longer merely answer: they anticipate, negotiate and sometimes push back. In newsrooms, hospitals and courtrooms, autonomous agents propose decisions, draft summaries and flag their own uncertainty. Some observers speak of a 'second cognitive wave': systems capable of doubting, asking for clarification and refusing a poorly specified task. Others worry about a silent dependency, where humans approve without truly understanding. One thing is certain: the question is no longer whether AIs think, but how we will coexist with them." | |
| # Questions | |
| payload = { | |
| "tone": { | |
| "type": "choice", | |
| "instructions": "What is the dominant tone of `body`?", | |
| "criteria": { | |
| "neutral": "factual account, no judgment", | |
| "alarmist": "emphasis on risks and dangers", | |
| "enthusiastic": "emphasis on promises and benefits" | |
| } | |
| }, | |
| "domain_coverage": { | |
| "type": "score", | |
| "instructions": "How many distinct application domains are covered in `body`?", | |
| "criteria": ["none", "one", "two", "three or more"] | |
| }, | |
| "mentions_doubt": { | |
| "type": "noul", | |
| "instructions": "Does the text mention AIs' ability to doubt or flag their own uncertainty?" | |
| } | |
| } | |
| # Predict/Evaluate | |
| timer = time.perf_counter() | |
| result = agent.predict({ "body": article }, payload) | |
| # Show result | |
| for name in payload: | |
| print(payload[name]['instructions']) | |
| print('->', result["answers"][name][payload[name]['type']], '\n') | |
| # Debug | |
| print(f"Duration: {((time.perf_counter() - timer) * 1000):.2f} ms") |