Text Generation
Transformers
Safetensors
French
qwen3
benin
french
continued-pretraining
finanfa-tech
conversational
text-generation-inference
Instructions to use finanfa-tech/Benin-Base-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use finanfa-tech/Benin-Base-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="finanfa-tech/Benin-Base-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("finanfa-tech/Benin-Base-4B") model = AutoModelForCausalLM.from_pretrained("finanfa-tech/Benin-Base-4B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use finanfa-tech/Benin-Base-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "finanfa-tech/Benin-Base-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "finanfa-tech/Benin-Base-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/finanfa-tech/Benin-Base-4B
- SGLang
How to use finanfa-tech/Benin-Base-4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "finanfa-tech/Benin-Base-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "finanfa-tech/Benin-Base-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "finanfa-tech/Benin-Base-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "finanfa-tech/Benin-Base-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use finanfa-tech/Benin-Base-4B with Docker Model Runner:
docker model run hf.co/finanfa-tech/Benin-Base-4B
License (Benin-Base Community License v1.0, provisional), gated-access notice, attribution of sources, README/NOTICE/PROVENANCE. Weights, tokenizer and config.json unchanged. Still private.
832a3b4 verified |
Download README.md from finanfa-tech/Benin-Base-4B: direct link, hf CLI and curl.
- Browser
- Download file 9.72 kB
-
https://huggingface.co/finanfa-tech/Benin-Base-4B/resolve/main/README.md
- Command line
-
hf download hf://finanfa-tech/Benin-Base-4B/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/finanfa-tech/Benin-Base-4B/resolve/main/README.md
9.72 kB
| license: other | |
| license_name: benin-base-community-license-v1 | |
| license_link: LICENSE | |
| language: | |
| - fr | |
| base_model: Qwen/Qwen3-4B-Base | |
| base_model_relation: finetune | |
| author: AWADEME Ronaldo | |
| publisher: FINANFA TECH | |
| extra_gated_prompt: "Accès sur demande : lisez et acceptez la Benin-Base Community License (provisoire) et le NOTICE. Les droits des tiers sur les données d'entraînement n'ont pas tous été vérifiés ; la licence n'accorde que les droits du concédant, sans garantie. Modèle expérimental, non validé par des humains. / Access on request: read and accept the Benin-Base Community License (provisional) and the NOTICE. Third-party rights on the training data have not all been verified; the license grants only the Licensor's rights, without warranty. Experimental model, not human-validated." | |
| extra_gated_fields: | |
| Nom complet / Full name: text | |
| Organisation / Organization: text | |
| Pays / Country: country | |
| Usage prévu / Intended use: text | |
| J'ai lu la licence et le NOTICE et j'accepte leurs conditions / I have read and accept the license and the NOTICE: checkbox | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - benin | |
| - french | |
| - continued-pretraining | |
| - qwen3 | |
| - finanfa-tech | |
| # Benin-Base-4B (v1, CPT) — FINANFA TECH | |
| > **Statut : publication publique à accès conditionné (« gated »). Modèle expérimental, non validé par des humains. Les droits des tiers sur les données d'entraînement n'ont pas tous été vérifiés (voir `NOTICE.md`).** | |
| **Auteur et initiateur : AWADEME Ronaldo** | |
| **Organisation éditrice : FINANFA TECH** | |
| **Modèle initial : Qwen3-4B-Base** — © Qwen Team (Alibaba Cloud), licence Apache-2.0, avec attribution à ses créateurs. | |
| © 2026 AWADEME Ronaldo, FINANFA TECH pour le travail d'adaptation (CPT S045, fusion) et les données du projet Benin-Base, sous réserve des mentions de `NOTICE.md`. Licence : **Benin-Base Community License v1.0 (provisoire)**, fichier `LICENSE`. | |
| **Version :** `v1.0.0` — poids fusionnés au commit `9a2fe0d2459740fac64a8474af8b87c9f71d7fe1` ; SHA256 de tous les fichiers : `MANIFEST_SHA256.json` ; provenance lisible par machine : `PROVENANCE.json`. | |
| ## Français | |
| **Benin-Base-4B** est la version **CPT seule** (pré-entraînement continu, sans fine-tuning d'instructions) de la famille **Benin-Base**, conçue pour favoriser le développement de l'IA au Bénin. Les sources du corpus (Wikipédia, HAL, textes officiels) et leurs licences sont listées dans `ATTRIBUTION_SOURCES.jsonl`. Elle s'adresse aux développeurs qui veulent **poursuivre le pré-entraînement** ou **créer leur propre modèle instruct**. Une version de conversation, **Benin-Base-4B-Instruct** (CPT + SFT), est en préparation et n'est pas publiée. | |
| - **Architecture :** Qwen3 (décodeur dense), 4,02 milliards de paramètres, 36 couches, dimension cachée 2 560, 32 têtes (8 clé/valeur), vocabulaire 151 936, embeddings liés ; poids complets **BF16** (≈ 8 Go). | |
| - **Filiation :** Qwen3-4B-Base (rév. `906bfd4b4dc7f14ee4320094d8b41684abff8539`) → **CPT S045** (adaptateur LoRA r=32, α=64, QLoRA NF4, checkpoint au pas 45 (le run s'est arrêté au pas 60 ; calendrier de taux d'apprentissage de 120 pas) ; 737 280 positions vues, 490 documents distincts d'un corpus de 1 080 documents (2,6 M tokens) : Wikipédia FR, articles HAL, textes juridiques et institutionnels béninois ; adaptateur sha256 `30e3e9d8…58b4`) → **fusion BF16** sans entraînement supplémentaire. Tokenizer et `generation_config` identiques à Qwen3-4B-Base ; **pas de chat template** (les lignes `<|im_start|>`/`<|im_end|>` ne sont pas entraînées). | |
| - **Capacités réellement évaluées :** le statut scientifique du CPT dans le projet est « succès partiel » ; le gain factuel n'a **pas** été évalué et aucune confirmation indépendante n'existe. La fusion a été validée contre l'adaptateur non fusionné (accord top-1 ≥ 97 % fixé avant exécution, divergence KL, intégrité) : voir `MERGE_VALIDATION_REPORT.json` et `MANIFEST_SHA256.json`. | |
| - **Limites :** ne maîtrise pas tous les domaines ni toutes les langues béninoises ; connaissances factuelles non garanties ; peut répéter ou halluciner ; ne pas utiliser pour du conseil juridique, financier ou médical ; ne suit pas d'instructions de manière fiable (modèle de complétion). | |
| - **Exigences matérielles :** ≈ 8 Go de poids pour l'inférence BF16 (≥ 10 Go de VRAM conseillés) ; reprise du pré-entraînement : GPU ≥ 24 Go conseillé (non mesuré). | |
| ```python | |
| import torch | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| repo = "finanfa-tech/Benin-Base-4B" | |
| tok = AutoTokenizer.from_pretrained(repo) | |
| model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto") | |
| x = tok("Le marché de Dantokpa, à Cotonou, est", return_tensors="pt").to(model.device) | |
| print(tok.decode(model.generate(**x, max_new_tokens=60, do_sample=False)[0], skip_special_tokens=True)) | |
| ``` | |
| Spécialisation : LoRA via PEFT (`LoraConfig(r=16, target_modules=["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"])`) ou poursuite du pré-entraînement ; pour obtenir un modèle de conversation, définissez votre propre format (par exemple ChatML) et entraînez les tokens correspondants. | |
| ### Métadonnées d'origine dans `config.json` | |
| Le fichier `config.json` contient un objet `benin_base_metadata` (famille, nom, version, créateur de Benin-Base, modèle initial et son créateur, étapes d'entraînement, type de modèle). **Distinction :** `model_creator` désigne le créateur de **Benin-Base** (AWADEME Ronaldo, FINANFA TECH). `upstream_model` et `upstream_creator` désignent le modèle initial **Qwen3-4B-Base, créé par la Qwen Team (Alibaba Cloud)** : FINANFA TECH n'est pas la créatrice du modèle Qwen. Aucun paramètre technique n'a été modifié. Cet objet est conservé par `save_pretrained` : un modèle dérivé (fine-tune, fusion) hérite de ces informations d'origine, mais `model_creator` ne désigne pas le créateur du modèle dérivé ; les dérivés devraient ajouter leurs propres métadonnées et indiquer leur filiation. | |
| **Provenance et licence (état vérifié) :** vérifié : le modèle initial est sous Apache-2.0. Licence des poids : **Benin-Base Community License v1.0 (provisoire, non relue par un juriste)** (usage, modification, spécialisation et usage commercial permis sous conditions ; elle n'accorde que les droits du concédant). Non vérifié : les droits des tiers sur les textes du corpus CPT (y compris 12 rapports institutionnels, 11,8 % du CPT, dont les éditeurs restreignent l'usage commercial, les dérivés ou l'entraînement d'IA, et dont aucun n'est sous licence ouverte ; dont des textes officiels dont les sites réservent la reproduction, que l'art. 9 de la loi béninoise 2005-30 exclut en principe de la protection, point non tranché juridiquement, et des contenus CC BY-SA dont l'effet sur des poids n'est pas tranché) ; vous êtes responsable d'évaluer votre usage, notamment commercial ou en redistribution. Voir `NOTICE.md`. | |
| ## English | |
| **Benin-Base-4B** is the **CPT-only** (continued pre-training, no instruction tuning) member of the **Benin-Base** family, meant to support AI development in Benin; for developers who want to continue pre-training or build their own instruct model. A chat version, **Benin-Base-4B-Instruct** (CPT + SFT), is in preparation and not published. Qwen3 dense decoder, 4.02B parameters, 36 layers, hidden 2,560, 32 heads (8 KV), vocab 151,936, tied embeddings, full **BF16** weights (≈ 8 GB). Lineage: Qwen3-4B-Base (rev `906bfd4b…`) → CPT S045 (LoRA r=32, α=64, step 45 (run stopped at step 60; learning-rate schedule of 120 steps), 490 distinct documents of a 1,080-document corpus) → BF16 merge with no further training; tokenizer and generation config identical to the base; **no chat template**. CPT scientific status in the project: partial success, factual gain not evaluated, no independent confirmation. Merge validation: see `MERGE_VALIDATION_REPORT.json` (top-1 agreement criterion ≥ 97 % fixed before the run). Limits: not all domains or Beninese languages, no reliable instruction following, not for legal/financial/medical advice. **License:** base model Apache-2.0 (verified); weights under the **Benin-Base Community License v1.0 (provisional, not reviewed by counsel)**: use, modification, specialisation and commercial use allowed under conditions; it grants only the Licensor's rights. Rights on the CPT texts are **not** verified (including 12 institutional reports, 11.8 % of the CPT, whose publishers restrict commercial use, derivatives or AI training and none of which is under an open license; texts subject to reproduction conditions; CC BY-SA content whose effect on weights is unsettled): you are responsible for assessing your use. See `NOTICE.md`. **Author and initiator:** AWADEME Ronaldo. **Publisher:** FINANFA TECH. **Base model:** Qwen3-4B-Base (Qwen Team, Alibaba Cloud, Apache-2.0). | |
| **Origin metadata in `config.json`:** the file contains a `benin_base_metadata` object (family, name, version, Benin-Base creator, upstream model and its creator, training stage, model type). `model_creator` designates the creator of **Benin-Base** (AWADEME Ronaldo, FINANFA TECH); `upstream_model`/`upstream_creator` designate the initial model **Qwen3-4B-Base, created by the Qwen Team (Alibaba Cloud)**, which FINANFA TECH did not create. No technical parameter was changed. The object survives `save_pretrained`: derived models inherit this origin information, but `model_creator` does not designate the creator of a derived model, which should add its own metadata and state its lineage. | |