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
Download examples/predict_rerank.py from Wouze/laya-ara-rag: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/Wouze/laya-ara-rag/resolve/main/examples/predict_rerank.py
- Command line
-
hf download hf://Wouze/laya-ara-rag/examples/predict_rerank.py
-
curl -L -o predict_rerank.py https://huggingface.co/Wouze/laya-ara-rag/resolve/main/examples/predict_rerank.py
1.29 kB
| #!/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() | |