sofial commited on
Commit
3b1edd6
1 Parent(s): 449a711

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -1
README.md CHANGED
@@ -45,4 +45,20 @@ Fine tuned on a Graphcore IPU-POD64 using `popxl`.
45
 
46
  Prompt sentences are tokenized and packed together to form 1024 token sequences, following [HF packing algorithm](https://github.com/huggingface/transformers/blob/v4.20.1/examples/pytorch/language-modeling/run_clm.py). No padding is used.
47
  Since the model is trained to predict the next token, labels are simply the input sequence shifted by one token.
48
- Given the training format, no extra care is needed to account for different sequences: the model does not need to know which sentence a token belongs to.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  Prompt sentences are tokenized and packed together to form 1024 token sequences, following [HF packing algorithm](https://github.com/huggingface/transformers/blob/v4.20.1/examples/pytorch/language-modeling/run_clm.py). No padding is used.
47
  Since the model is trained to predict the next token, labels are simply the input sequence shifted by one token.
48
+ Given the training format, no extra care is needed to account for different sequences: the model does not need to know which sentence a token belongs to.
49
+
50
+ ## How to use
51
+ The model can be easily loaded using AutoModelForCausalLM.
52
+ Text generation can be implemented or via the pipeline API.
53
+
54
+ ```python
55
+ from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
56
+
57
+ hf_model = AutoModelForCausalLM.from_pretrained("Graphcore/gptj-mnli")
58
+ tokenizer = AutoTokenizer.from_pretrained('EleutherAI/gpt-j-6B')
59
+ generator = pipeline('text-generation', model=hf_model, tokenizer=tokenizer)
60
+ prompt = "mnli hypothesis: Your contributions were of no help with our students' education." \
61
+ "premise: Your contribution helped make it possible for us to provide our students with a quality education. target:"
62
+ out = generator(prompt, return_full_text=False, max_new_tokens=5, top_k=1)
63
+ # [{'generated_text': ' contradiction'}]
64
+ ```