Kinya-COLBERT Free

This is an information retrieval / embedding model for RAG systems in Kinyarwanda. It was trained on agricultural question answer pairs.

About the project

In Rwanda, many farmers struggle to access timely, personalized agricultural information. Traditional channels - like radio, TV, and online sources - offer limited reach and interactivity, while extension services and a national call center, staffed by only two agents for over two million farmers, face capacity constraints. To address these gaps, we developed a 24/7 AI-enabled Interactive Voice Response (IVR) tool. Accessible via a Kinyarwanda-speaking hotline, this tool provides advisory on topics such as pest and disease diagnosis and agro-climatic practices, as well as information on MINAGRI’s support programs for farmers, e.g. crop insurances. By utilizing AI and IVR technology, this project will make agricultural advisories more accessible, timely, and responsive to farmers’ needs. For more information, please reach out to C4IR.

Implemented by: C4IR Rwanda & KiNLP; Supported by GIZ; Financed by: BMZ.

Usage

pip install ragatouille==0.0.8 transformers==4.49
from ragatouille import RAGPretrainedModel
from ragatouille.utils import get_wikipedia_page

# load the model
model = RAGPretrainedModel.from_pretrained("C4IR-RW/kiny-colbert-free")

# create and index knowledge base
# the first article is about maiz farming, the 2nd about cattle vaccination
knowledge_base = [
  "Ikigori ni igihingwa cy’ingenzi gikura neza mubutaka bukungahaye kandi budatunganyije amazi, ahari izuba rihagije. Abahinzi bakwiye gutera imbuto mu ntiriranywa y’ibihe by’imvura kugira ngo ibihingwa bikiri bito bibone amazi ahagije. Kubagara kenshi no gushyiramo ifumbire y'imborera cyangwa iy'imvugururaburinganire ni ingenzi kugira ngo umusaruro ube mwiza. Iyo amashushu abaye ay'ikigina n'impeke zikaba zishitse, ibigori biba bishobora gusarurwa no guhunikwa.",
  "Gukingira inka ni intambwe y'ingenzi mu kwirinda indwara zica nka Borigo, Uburenge, n'Igifuruta. Kuriha inkingo hakiri kare birahendutse kuruta kuvura amatungo yarwaye. Abahinzi bakwiye gukorana bya hafi n'umuvuzi w'amatungo kugira ngo bagire ingengabihe y'inkingo ihoraho, bityo basigasire ubuzima n'umusaruro w'amatungo yabo."
]

index_path = model.index(index_name="my_index", collection=knowledge_base)

# retrieve data

# question about maize farming
question = "Mfite ikibazo kijyanye n'ubuhinzi bw'ibigori"

RAG = RAGPretrainedModel.from_index(index_path)
results = RAG.search(question)

print(results)

"""
Outputs:

[{'content': "Ikigori ni igihingwa cy’ingenzi gikura neza mubutaka bukungahaye kandi budatunganyije amazi, ahari izuba rihagije. Abahinzi bakwiye gutera imbuto mu ntiriranywa y’ibihe by’imvura kugira ngo ibihingwa bikiri bito bibone amazi ahagije. Kubagara kenshi no gushyiramo ifumbire y'imborera cyangwa iy'imvugururaburinganire ni ingenzi kugira ngo umusaruro ube mwiza. Iyo amashushu abaye ay'ikigina n'impeke zikaba zishitse, ibigori biba bishobora gusarurwa no guhunikwa.",
  'score': 19.476581573486328,
  'rank': 1,
  'document_id': '74d59927-b84f-4140-a35a-17477787453b',
  'passage_id': 0}]
"""

License

This model is licensed under the Creative Commons Attribution 4.0 International License (CC-BY 4.0).

Attribution: Please attribute this work to C4IR Rwanda and KiNLP.

Downloads last month
22
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for C4IR-RW/kiny-colbert-free