Text Generation
Transformers
Safetensors
French
gpt2
causal-lm
french
literary
from-scratch
text-generation-inference
Instructions to use Mathieu680/Rastignac-1.0-126M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mathieu680/Rastignac-1.0-126M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mathieu680/Rastignac-1.0-126M")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Mathieu680/Rastignac-1.0-126M") model = AutoModelForCausalLM.from_pretrained("Mathieu680/Rastignac-1.0-126M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Mathieu680/Rastignac-1.0-126M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mathieu680/Rastignac-1.0-126M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mathieu680/Rastignac-1.0-126M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Mathieu680/Rastignac-1.0-126M
- SGLang
How to use Mathieu680/Rastignac-1.0-126M 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 "Mathieu680/Rastignac-1.0-126M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mathieu680/Rastignac-1.0-126M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Mathieu680/Rastignac-1.0-126M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mathieu680/Rastignac-1.0-126M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Mathieu680/Rastignac-1.0-126M with Docker Model Runner:
docker model run hf.co/Mathieu680/Rastignac-1.0-126M
Réécrit la fiche modèle Rastignac 1.0
Browse files
README.md
CHANGED
|
@@ -12,17 +12,18 @@ tags:
|
|
| 12 |
|
| 13 |
# Rastignac 1.0 — 126M
|
| 14 |
|
| 15 |
-
Rastignac 1.0 est un modèle de langage causal français
|
| 16 |
-
|
| 17 |
-
française. Il est
|
| 18 |
-
de phrase ou de paragraphe
|
|
|
|
| 19 |
|
| 20 |
-
## Utilisation
|
| 21 |
|
| 22 |
```python
|
| 23 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 24 |
|
| 25 |
-
model_id = "Mathieu680/Rastignac-126M"
|
| 26 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 27 |
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 28 |
|
|
@@ -41,56 +42,57 @@ output = model.generate(
|
|
| 41 |
print(tokenizer.decode(output[0], skip_special_tokens=False))
|
| 42 |
```
|
| 43 |
|
| 44 |
-
Le
|
| 45 |
-
dépôt :
|
| 46 |
|
| 47 |
-
```
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
```
|
| 50 |
|
| 51 |
-
## Architecture
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
et
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
commerciale ou une redistribution large, il faut vérifier les auteurs, les
|
| 87 |
-
éditions et la loi du pays concerné. Aucun corpus complet ni licence générale
|
| 88 |
-
de domaine public n'est revendiqué ici.
|
| 89 |
|
| 90 |
## Reproduction
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
fichiers binaires du corpus ne sont pas inclus.
|
|
|
|
| 12 |
|
| 13 |
# Rastignac 1.0 — 126M
|
| 14 |
|
| 15 |
+
Rastignac 1.0 est un modèle de langage causal français de **126 481 920
|
| 16 |
+
paramètres**, entraîné entièrement depuis zéro sur **3 348 livres de la
|
| 17 |
+
littérature française**. Il est destiné à la complétion de texte : à partir
|
| 18 |
+
d’un début de phrase ou de paragraphe, il génère la suite dans un registre
|
| 19 |
+
français à dominante littéraire.
|
| 20 |
|
| 21 |
+
## Utilisation
|
| 22 |
|
| 23 |
```python
|
| 24 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 25 |
|
| 26 |
+
model_id = "Mathieu680/Rastignac-1.0-126M"
|
| 27 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 28 |
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 29 |
|
|
|
|
| 42 |
print(tokenizer.decode(output[0], skip_special_tokens=False))
|
| 43 |
```
|
| 44 |
|
| 45 |
+
Le modèle peut également être utilisé avec le pipeline standard :
|
|
|
|
| 46 |
|
| 47 |
+
```python
|
| 48 |
+
from transformers import pipeline
|
| 49 |
+
|
| 50 |
+
generator = pipeline(
|
| 51 |
+
"text-generation",
|
| 52 |
+
model="Mathieu680/Rastignac-1.0-126M",
|
| 53 |
+
)
|
| 54 |
+
print(generator("La nuit tombait sur Paris lorsque", max_new_tokens=120)[0]["generated_text"])
|
| 55 |
```
|
| 56 |
|
| 57 |
+
## Architecture
|
| 58 |
+
|
| 59 |
+
| Élément | Valeur |
|
| 60 |
+
|---|---:|
|
| 61 |
+
| Architecture | Transformer causal de type GPT-2 |
|
| 62 |
+
| Paramètres | 126 481 920 |
|
| 63 |
+
| Couches Transformer | 16 |
|
| 64 |
+
| Têtes d’attention | 12 |
|
| 65 |
+
| Dimension cachée | 768 |
|
| 66 |
+
| Dimension MLP | 3 072 |
|
| 67 |
+
| Vocabulaire | 16 000 tokens BPE byte-level |
|
| 68 |
+
| Contexte maximal | 1 024 tokens |
|
| 69 |
+
| Poids | `model.safetensors` |
|
| 70 |
+
|
| 71 |
+
## Entraînement
|
| 72 |
+
|
| 73 |
+
Le modèle a été entraîné depuis zéro avec un objectif de prédiction du token
|
| 74 |
+
suivant. Le corpus contient **315 832 633 tokens d’entraînement** et
|
| 75 |
+
**27 511 882 tokens de validation**. La date de publication indiquée pour les
|
| 76 |
+
œuvres datées est en moyenne d’environ **1898** (763 œuvres disposent d’une
|
| 77 |
+
date explicite dans les métadonnées).
|
| 78 |
+
|
| 79 |
+
L’entraînement a représenté **30 000 mises à jour**, soit **983 040 000 tokens
|
| 80 |
+
parcourus**. La meilleure loss de validation interne est **2,7920**, obtenue à
|
| 81 |
+
l’étape 29 750.
|
| 82 |
+
|
| 83 |
+
## Données
|
| 84 |
+
|
| 85 |
+
Le corpus a été constitué à partir d’ebooks français référencés par Project
|
| 86 |
+
Gutenberg. Les fichiers du corpus ne sont pas inclus dans ce dépôt.
|
| 87 |
+
|
| 88 |
+
Les droits applicables peuvent dépendre de l’auteur, de l’édition et du pays
|
| 89 |
+
où le modèle est utilisé ; il est recommandé de consulter la
|
| 90 |
+
[licence de Project Gutenberg](https://www.gutenberg.org/policy/license) avant
|
| 91 |
+
toute réutilisation.
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
## Reproduction
|
| 94 |
|
| 95 |
+
`training_metadata.json` et `provenance.json` décrivent l’export, le checkpoint,
|
| 96 |
+
le tokenizer et les volumes de données utilisés. Le dépôt contient uniquement
|
| 97 |
+
les poids, le tokenizer et les fichiers nécessaires au chargement avec
|
| 98 |
+
Transformers ; l’état de l’optimiseur et le corpus brut ne sont pas inclus.
|
|
|