Downloads · 30 days
60
4% of all-time downloads
Mohamad-Jaallouk/model-to-production-2.1
model-to-production-2.1 is a machine learning model from Mohamad-Jaallouk. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Fine-tuned text classification model based on google/gemma-3-1b-it for detecting AI-generated vs human-written text across 85+ languages. Trained using LoRA and merged into a standalone model for simple deployment.
Downloads · 30 days
60
4% of all-time downloads
All-time downloads
1.6K
Public
Parameters
1000M
2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2 GB · 98%
From the Hugging Face model README
Fine-tuned text classification model based on google/gemma-3-1b-it for detecting AI-generated vs human-written text across 85+ languages. Trained using LoRA and merged into a standalone model for simple deployment.
| ID | Label | Description |
|---|---|---|
| 0 | Human | Human-written text |
| 1 | AI | AI-generated text |
Validation Set Results (2,977 examples, 85 languages):
Achieved after 41,600 steps (1 epoch) with early stopping.
The model was trained on 85 languages from the FineWeb2 dataset, covering diverse scripts:
See datasets/language_distribution.md for the complete list of ISO 639-3 language codes.
pip install transformers torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "Mohamad-Jaallouk/model-to-production-2.1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Example text (any of 85+ supported languages)
text = "This is a sample text to classify."
# Tokenize and predict
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = predictions.argmax().item()
confidence = predictions[0][predicted_class].item()
print(f"Prediction: {'AI' if predicted_class == 1 else 'Human'}")
print(f"Confidence: {confidence:.2%}")
from transformers import pipeline
# Create classification pipeline
classifier = pipeline(
"text-classification",
model="Mohamad-Jaallouk/model-to-production-2.1",
device=0 # Use GPU if available, -1 for CPU
)
# Classify text
result = classifier("Your text here", truncation=True, max_length=512)
print(result)
# Output: [{'label': 'LABEL_0', 'score': 0.9873}]
# LABEL_0 = Human, LABEL_1 = AI
texts = [
"First sample text in English.",
"Deuxième exemple de texte en français.",
"Tercer ejemplo de texto en español.",
]
results = classifier(texts, truncation=True, max_length=512, batch_size=8)
for text, result in zip(texts, results):
label = "Human" if result['label'] == 'LABEL_0' else "AI"
print(f"{label} ({result['score']:.2%}): {text[:50]}...")
Human Text:
AI Text:
Training data was augmented with character-level transformations for robustness:
See transform.py for implementation details.
python train.py \
--model-id google/gemma-3-1b-it \
--data train.csv \
--val-data val_small.csv \
--output-dir gemma-3-1b-it_lora_cls_pt \
--max-length 512 \
--epochs 1 \
--lr 5e-5 \
--batch-size 16 \
--eval-batch-size 32 \
--grad-accum-steps 1 \
--warmup-ratio 0.1 \
--eval-every-steps 400 \
--lora-r 64 \
--lora-alpha 128 \
--lora-dropout 0.1 \
--pad-side left \
--hf-token $HF_TOKEN
All training code and data are included in this repository for full reproducibility.
# Clone repository
git clone https://huggingface.co/Mohamad-Jaallouk/model-to-production-2.1
cd model-to-production-2.1
# Install dependencies
pip install -r requirements.txt
# Set HuggingFace token (for gated models)
export HF_TOKEN=your_hf_token_here
python train.py \
--model-id google/gemma-3-1b-it \
--data datasets/train.csv \
--val-data datasets/val.csv \
--output-dir my_model \
--hf-token $HF_TOKEN
# See train.py for all available arguments
python train.py --help
Predicted
Human AI
Actual
Human [...] [...]
AI [...] [...]
The model maintains high performance across all 85 languages. See evaluation/per_language_metrics.json for detailed breakdown.
✅ Recommended:
❌ Not Recommended:
@model{model-to-production-2.1,
title={model-to-production-2.1: Multilingual AI Text Detection},
author={Mohamad Jaallouk},
year={2025},
publisher={HuggingFace},
url={https://huggingface.co/Mohamad-Jaallouk/model-to-production-2.1},
base_model={google/gemma-3-1b-it}
}
If you use the training data, please also cite FineWeb2:
@dataset{fineweb2,
title={FineWeb2: A sparkling update with 1000s of languages},
author={HuggingFace},
year={2024},
publisher={HuggingFace},
url={https://huggingface.co/datasets/HuggingFaceFW/fineweb-2}
}
This model is released under the Apache 2.0 License, consistent with the base Gemma-3 model license.
The training data includes:
Version: 2.1 Last Updated: 2025-11-10 Framework Versions: transformers 4.57.0, PEFT 0.17.1, PyTorch 2.x