kalhosni commited on
Commit
ff14fdd
1 Parent(s): c87de3b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -1
README.md CHANGED
@@ -12,4 +12,32 @@ language:
12
  library_name: adapter-transformers
13
  ---
14
 
15
- # Model Trained Using AutoTrain
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  library_name: adapter-transformers
13
  ---
14
 
15
+ # Model Trained Using AutoTrain
16
+
17
+
18
+ Code for Training:
19
+
20
+ from transformers import AutoTokenizer
21
+ import transformers
22
+ import torch
23
+
24
+ model = "meta-llama/Llama-2-7b-chat-hf"
25
+
26
+ tokenizer = AutoTokenizer.from_pretrained(model)
27
+ pipeline = transformers.pipeline(
28
+ "text-generation",
29
+ model=model,
30
+ torch_dtype=torch.float16,
31
+ device_map="auto",
32
+ )
33
+
34
+ sequences = pipeline(
35
+ 'I liked "Breaking Bad" and "Band of Brothers". Do you have any recommendations of other shows I might like?\n',
36
+ do_sample=True,
37
+ top_k=10,
38
+ num_return_sequences=1,
39
+ eos_token_id=tokenizer.eos_token_id,
40
+ max_length=200,
41
+ )
42
+ for seq in sequences:
43
+ print(f"Result: {seq['generated_text']}")