jpacifico commited on
Commit
47fb0ff
1 Parent(s): 08e4192

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -0
README.md CHANGED
@@ -23,6 +23,34 @@ French-Alpaca is a general model and can itself be finetuned to be specialized f
23
 
24
  The fine-tuning method is inspired from https://crfm.stanford.edu/2023/03/13/alpaca.html
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  ### Limitations
27
 
28
  The French-Alpaca model is a quick demonstration that a base 7B model can be easily fine-tuned to specialize in a particular language.
 
23
 
24
  The fine-tuning method is inspired from https://crfm.stanford.edu/2023/03/13/alpaca.html
25
 
26
+ ### Usage & Test
27
+
28
+ ```python
29
+ #!pip install transformers accelerate
30
+
31
+ from transformers import AutoTokenizer
32
+ import transformers
33
+ import torch
34
+
35
+ model = "jpacifico/French-Alpaca-7B-Instruct-beta"
36
+ messages = [{"role": "user", "content": "Rédige un article sur la fin des vendanges dans le Mâconnais."}]
37
+
38
+ tokenizer = AutoTokenizer.from_pretrained(model)
39
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
40
+ pipeline = transformers.pipeline(
41
+ "text-generation",
42
+ model=model,
43
+ torch_dtype=torch.float16,
44
+ device_map="auto",
45
+ )
46
+
47
+ outputs = pipeline(prompt, max_new_tokens=128, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
48
+ print(outputs[0]["generated_text"])
49
+ ```
50
+
51
+ You can test French-Alpaca with this dedicated and compatible colab notebook (with GPU) :
52
+ https://github.com/jpacifico/French-Alpaca/blob/main/French_Alpaca_inference_test_colab.ipynb
53
+
54
  ### Limitations
55
 
56
  The French-Alpaca model is a quick demonstration that a base 7B model can be easily fine-tuned to specialize in a particular language.