File size: 2,365 Bytes
994fa15
 
f2d5a01
 
 
 
 
 
994fa15
 
f2d5a01
994fa15
08e4192
 
 
994fa15
 
 
f2d5a01
 
994fa15
f2d5a01
994fa15
f2d5a01
994fa15
47fb0ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3155fcc
47fb0ff
 
c44e7d7
 
 
 
 
 
f2d5a01
994fa15
f2d5a01
 
994fa15
f2d5a01
 
 
 
78b414e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
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