Text Classification
Transformers
Safetensors
Laya
Arabic
modernbert
feature-extraction
arabic
information-retrieval
reranking
rag
custom_code
Eval Results (legacy)
Instructions to use Wouze/laya-ara-rag with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Wouze/laya-ara-rag with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Wouze/laya-ara-rag", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Wouze/laya-ara-rag", trust_remote_code=True) model = AutoModel.from_pretrained("Wouze/laya-ara-rag", trust_remote_code=True, device_map="auto") - Laya
How to use Wouze/laya-ara-rag 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
File size: 1,285 Bytes
c354c7f 5d6242d c354c7f | 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 31 32 33 34 35 36 37 38 39 40 41 42 | #!/usr/bin/env python3
"""Listwise short-list rerank + pairwise noul. Passages are invented."""
from __future__ import annotations
import os
os.environ.setdefault("USE_TF", "0")
import laya
# pip install laya==0.3.4
# Local override: LAYA_AR_MODEL=/path/to/artifacts/laya-ara-rag
MODEL = os.environ.get("LAYA_AR_MODEL", "Wouze/laya-ara-rag")
STATE = {"query": "ما حكم الوضوء قبل قراءة القرآن؟"}
QUESTIONS = {
"passage": {
"type": "choice",
"instructions": "Which passage is most relevant to the query?",
"criteria": {
"a": "الوضوء شرط للصلاة. أما قراءة القرآن من غير مس المصحف فالجمهور على الجواز.",
"b": "زكاة الفطر تجب على كل مسلم قبل صلاة العيد صاعا من طعام.",
"c": "صيام يوم عاشوراء سنة مؤكدة ويكفر سنة قبله.",
},
},
"relevant_a": {
"type": "noul",
"instructions": "Is passage A relevant to the query about wudu before Quran recitation?",
},
}
def main() -> None:
agent = laya.load(MODEL, token=os.environ.get("HF_TOKEN"))
print(agent.predict(STATE, QUESTIONS))
if __name__ == "__main__":
main()
|