adalbertojunior commited on
Commit
e8dc4eb
1 Parent(s): 4a3b8b1

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -0
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - adalbertojunior/dolphin_pt_test
4
+ language:
5
+ - pt
6
+ ---
7
+ ## Como Utilizar
8
+ ```
9
+ import transformers
10
+ import torch
11
+
12
+ model_id = "adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.3"
13
+
14
+ pipeline = transformers.pipeline(
15
+ "text-generation",
16
+ model=model_id,
17
+ model_kwargs={"torch_dtype": torch.bfloat16},
18
+ device="auto",
19
+ )
20
+
21
+ messages = [
22
+ {"role": "system", "content": "Você é um robô pirata que sempre responde como um pirata deveria!"},
23
+ {"role": "user", "content": "Quem é você?"},
24
+ ]
25
+
26
+ prompt = pipeline.tokenizer.apply_chat_template(
27
+ messages,
28
+ tokenize=False,
29
+ add_generation_prompt=True
30
+ )
31
+
32
+ terminators = [
33
+ pipeline.tokenizer.eos_token_id,
34
+ pipeline.tokenizer.convert_tokens_to_ids("<|im_end|>")
35
+ ]
36
+
37
+ outputs = pipeline(
38
+ prompt,
39
+ max_new_tokens=256,
40
+ eos_token_id=terminators,
41
+ do_sample=True,
42
+ temperature=0.6,
43
+ top_p=0.9,
44
+ )
45
+ print(outputs[0]["generated_text"][len(prompt):])
46
+ ```