File size: 2,225 Bytes
e077409
 
f6accf5
441bf68
 
 
 
 
79c181e
 
 
 
e077409
 
441bf68
e077409
f6accf5
e077409
441bf68
e077409
 
 
441bf68
 
e077409
441bf68
e077409
7f5d041
51887aa
3c0e974
 
b69cfc9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f6accf5
 
b69cfc9
441bf68
e077409
47b18f9
441bf68
e077409
441bf68
 
 
af4c1d4
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
---
library_name: transformers
license: apache-2.0
language:
- fr
- en
datasets:
- jpacifico/French-Alpaca-dataset-Instruct-110K
tags:
- llama3
- french
- llama-3-8B
---

## Model Card for Model ID

French-Alpaca based on Llama3-8B-Instruct

![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 Q4_K_M GGUF 4bits version available : jpacifico/french-alpaca-llama3-8B-Q4-GGUF

### Usage

```python

model_id = "jpacifico/French-Alpaca-Llama3-8B-Instruct-v1.0"
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config, device_map={"":0})
tokenizer = AutoTokenizer.from_pretrained(model_id, add_eos_token=True, padding_side='left')
streamer = TextStreamer(tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=True)

def stream_frenchalpaca(user_prompt):
    runtimeFlag = "cuda:0"
    system_prompt = 'Tu trouveras ci-dessous une instruction qui décrit une tâche. Rédige une réponse qui complète de manière appropriée la demande.\n\n'
    B_INST, E_INST = "### Instruction:\n", "### Response:\n"
    prompt = f"{system_prompt}{B_INST}{user_prompt.strip()}\n\n{E_INST}"
    inputs = tokenizer([prompt], return_tensors="pt").to(runtimeFlag)
    streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
    _ = model.generate(**inputs, streamer=streamer, max_new_tokens=500)

stream_frenchalpaca("your prompt here")
```
Colab notebook available on my Github :  
https://github.com/jpacifico/French-Alpaca/blob/main/French_Alpaca_Llama3_inference_test_colab.ipynb

### Limitations

The French-Alpaca model is a quick demonstration that a base 8B 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