|
--- |
|
library_name: transformers |
|
license: mit |
|
language: |
|
- fr |
|
- en |
|
datasets: |
|
- jpacifico/French-Alpaca-dataset-Instruct-110K |
|
tags: |
|
- Phi-3 |
|
- french |
|
- Phi-3-mini |
|
- french-alpaca |
|
--- |
|
|
|
## Model Card for Model ID |
|
|
|
French-Alpaca based on microsoft/Phi-3-mini-4k-instruct |
|
4k is the context length (in tokens) |
|
|
|
![image/jpeg](https://github.com/jpacifico/French-Alpaca/blob/main/Assets/French-Alpaca_500px.png?raw=true) |
|
|
|
### Model Description |
|
|
|
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 |
|
|
|
Quantized GGUF version : coming soon |
|
|
|
|
|
### Usage |
|
|
|
```python |
|
import torch |
|
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline |
|
|
|
torch.random.manual_seed(0) |
|
|
|
model = AutoModelForCausalLM.from_pretrained( |
|
"microsoft/Phi-3-mini-4k-instruct", |
|
device_map="cuda", |
|
torch_dtype="auto", |
|
trust_remote_code=True, |
|
) |
|
tokenizer = AutoTokenizer.from_pretrained("jpacifico/French-Alpaca-Phi-3-mini-4k-instruct-v1.0") |
|
|
|
messages = [ |
|
{"role": "system", "content": "Vous êtes un assistant numérique serviable. Veuillez fournir des informations sûres, éthiques et précises à l'utilisateur."}, |
|
{"role": "user", "content": "Pouvez-vous fournir des façons de manger des combinaisons de bananes et de fruits du dragon ?"}, |
|
{"role": "assistant", "content": "Bien sûr ! Voici quelques façons de manger des bananes et des fruits du dragon ensemble : 1. Smoothie à la banane et au fruit du dragon : mixez des bananes et des fruits du dragon avec un peu de lait et de miel. 2. Salade de banane et de fruit du dragon : mélangez des bananes tranchées et des fruits du dragon avec un peu de jus de citron et de miel."}, |
|
{"role": "user", "content": "Et pour résoudre une équation 2x + 3 = 7 ?"}, |
|
] |
|
|
|
pipe = pipeline( |
|
"text-generation", |
|
model=model, |
|
tokenizer=tokenizer, |
|
) |
|
|
|
generation_args = { |
|
"max_new_tokens": 500, |
|
"return_full_text": False, |
|
"temperature": 0.0, |
|
"do_sample": False, |
|
} |
|
|
|
output = pipe(messages, **generation_args) |
|
print(output[0]['generated_text']) |
|
|
|
``` |
|
|
|
### Limitations |
|
|
|
The French-Alpaca model is a quick demonstration that a 3B base 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:** MIT |