qanastek commited on
Commit
6ee2e20
1 Parent(s): 66143b0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +32 -0
README.md CHANGED
@@ -1,6 +1,38 @@
1
  ---
2
  library_name: peft
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  ## Training procedure
5
 
6
 
 
1
  ---
2
  library_name: peft
3
  ---
4
+
5
+ ## Inference
6
+
7
+ ```plain
8
+ from transformers import AutoTokenizer
9
+ import transformers
10
+ import torch
11
+
12
+ model = "qanastek/LLaMa-2-FrenchMedMCQA"
13
+
14
+ tokenizer = AutoTokenizer.from_pretrained(model)
15
+ pipeline = transformers.pipeline(
16
+ "text-generation",
17
+ model=model,
18
+ torch_dtype=torch.float16,
19
+ device_map="auto",
20
+ )
21
+
22
+ prompt = "Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request. ### Instruction: We are giving you a scientific question (easy level) and five answers options (associated to « A », « B », « C », « D », « E »). Your task is to find the correct(s) answer(s) based on scientific facts, knowledge and reasoning. Don't generate anything other than one of the following characters : 'A B C D E'. ### Input: Parmi les propositions suivantes, quelle est celle qui est exacte? Lorsqu'on ajoute un acide fort à une solution tampon: (A) Le pH reste constant (B) Le pH diminue légèrement (C) Le constituant basique du tampon reste constant (D) Le constituant acide du tampon réagit (E) Le rapport acide/base reste inchangé ### Response: "
23
+
24
+ seq = pipeline(
25
+ prompt,
26
+ do_sample=True,
27
+ top_k=10,
28
+ num_return_sequences=1,
29
+ eos_token_id=tokenizer.eos_token_id,
30
+ max_length=200,
31
+ )[0]
32
+
33
+ print(seq['generated_text'][len(prompt):])
34
+ ```
35
+
36
  ## Training procedure
37
 
38