Text Classification
Transformers
Safetensors
Laya
system-one
calibrated-decisions
rlcd
classification
routing
scoring
guardrails
moderation
reinforcement-learning
commercial-use
Instructions to use convaiinnovations/laya with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use convaiinnovations/laya with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="convaiinnovations/laya")# pip install -U transformers accelerate # Load model directly from transformers import LayaTypedDecisions model = LayaTypedDecisions.from_pretrained("convaiinnovations/laya", device_map="auto") - Laya
How to use convaiinnovations/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
- Inference
- Notebooks
- Google Colab
- Kaggle
Vision graft on Laya: meal photo β calories/macros + food questions (LayaMacro, open source)
#33
by Aquos06 - opened
Hi! Thanks for releasing Laya. I built LayaMacro, which grafts a frozen image encoder (SigLIP 2-large) onto Laya so it answers typed questions about a photo, and wanted to share it with you and the community.
How it works
- 576 SigLIP 2 patch tokens β a small projector β Laya's input, placed after the question and options, so the
[MASK]marker positions never move. - Every answer is still a Laya typed decision. Nutrition is five
scorequestions over 18 value ranges each (kcal, protein, carbs, fat, grams), giving calibrated 80 % ranges. Food questions arechoice: "Does this meal contain rice?", "Which of these foods is on the plate?" - ModernBERT backbone frozen; I trained the projector and Laya's decision head (28.6M parameters), 10 epochs on 2 GPUs.
Results (test photos)
- Calories: 48.5 kcal mean absolute error on Nutrition5k. A dedicated method, OmniFood8K, is clearly better there (36.8).
- Food questions: 0.89 on "contains X?" and 0.86 on "which of 5 foods?" (chance 0.56 / 0.20). A wording never used in training works as well (0.88). Foods never trained on: only 0.65.
- Caveat: training is seed-sensitive. A second seed did not learn the food questions.
Two notes from integrating (as of laya 0.3.20), in case they're useful
DecisionModel.forwarddoesn't takeinputs_embeds(the backbone does), so I reserve placeholder slots throughbuild_sequenceand overwrite their embeddings. That keeps yourmarker_posand masks as the source of truth.laya-typed-decisionsships achoice:11+temperature of β0.10, which the loader clamps to 0.5 with a warning.
Code (Apache-2.0): https://github.com/Aquos06/LayaMacro
Weights (CC BY-NC-SA 4.0, non-commercial; a research model, not a medical device): https://huggingface.co/Aquos06/LayaMacro
I'm not affiliated with you. Happy to answer questions, or to hear if I've misused anything.