|
--- |
|
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 GGUF 8bits version available : https://huggingface.co/jpacifico/French-Alpaca-Llama3-8B-Instruct-q8_0-v1.0-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 tiny 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 |