|
--- |
|
library_name: transformers |
|
license: apache-2.0 |
|
language: |
|
- fr |
|
- en |
|
datasets: |
|
- jpacifico/French-Alpaca-dataset-Instruct-110K |
|
--- |
|
|
|
## Model Card for Model ID |
|
|
|
A 7B language model. Good in French. |
|
|
|
![image/jpeg](https://github.com/jpacifico/French-Alpaca/blob/main/Assets/French-Alpaca_500px.png?raw=true) |
|
|
|
### Model Description |
|
|
|
The French-Alpaca is a 7.24B params LLM model based on the Mistral-7B-Instruct-v0.2 foundation model, |
|
fine-tuned from the original French-Alpaca-dataset entirely generated with OpenAI GPT-3.5-turbo. |
|
|
|
French-Alpaca is a general model and can itself be finetuned to be specialized for specific use cases. |
|
|
|
The fine-tuning method is inspired from https://crfm.stanford.edu/2023/03/13/alpaca.html |
|
|
|
### Usage & Test |
|
|
|
```python |
|
#!pip install transformers accelerate |
|
|
|
from transformers import AutoTokenizer |
|
import transformers |
|
import torch |
|
|
|
model = "jpacifico/French-Alpaca-7B-Instruct-beta" |
|
messages = [{"role": "user", "content": "Rédige un article sur la fin des vendanges dans le Mâconnais."}] |
|
|
|
tokenizer = AutoTokenizer.from_pretrained(model) |
|
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) |
|
pipeline = transformers.pipeline( |
|
"text-generation", |
|
model=model, |
|
torch_dtype=torch.float16, |
|
device_map="auto", |
|
) |
|
|
|
outputs = pipeline(prompt, max_new_tokens=128, do_sample=True, temperature=0.7, top_k=50, top_p=0.95) |
|
print(outputs[0]["generated_text"]) |
|
``` |
|
|
|
You can test French-Alpaca with this dedicated and compatible colab notebook (with free T4 GPU) : |
|
https://github.com/jpacifico/French-Alpaca/blob/main/French_Alpaca_inference_test_colab.ipynb |
|
|
|
This quantized GGUF version availabe is available here : https://huggingface.co/jpacifico/French-Alpaca-7B-Instruct-beta-GGUF |
|
It can be used on a CPU device, compatible with llama.cpp and LM Studio (cf screenshot below). |
|
|
|
![image/jpeg](https://github.com/jpacifico/French-Alpaca/blob/main/Assets/french-alpaca-gguf.png?raw=true) |
|
|
|
|
|
### Limitations |
|
|
|
The French-Alpaca model is a quick demonstration that a base 7B model can be easily fine-tuned to specialize in a particular language. |
|
It does not have any moderation mechanisms. |
|
|
|
- **Developed by:** Jonathan Pacifico, 2024 |
|
- **Model type:** LLM |
|
- **Language(s) (NLP):** French |
|
- **License:** Apache 2.0 |
|
- **Finetuned from model:** mistralai/Mistral-7B-Instruct-v0.2 |