davda54 commited on
Commit
b8849ff
1 Parent(s): 1029c86

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -4
README.md CHANGED
@@ -43,20 +43,20 @@ This model currently needs a custom wrapper from `modeling_nort5.py`, you should
43
  import torch
44
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
45
 
46
- tokenizer = AutoTokenizer.from_pretrained("ltg/nort5-base")
47
- t5 = AutoModelForSeq2SeqLM.from_pretrained("ltg/nort5-base")
48
 
49
 
50
  # MASKED LANGUAGE MODELING
51
 
52
- sentence = "Brukseksempel: Elektrisk oppvarming. Definisjonen på ordet oppvarming er[MASK_0]."
53
  encoding = tokenizer(sentence)
54
 
55
  input_tensor = torch.tensor([encoding.input_ids])
56
  output_tensor = model.generate(input_tensor, decoder_start_token_id=7, eos_token_id=8)
57
  tokenizer.decode(output_tensor.squeeze(), skip_special_tokens=True)
58
 
59
- # should output: å varme opp
60
 
61
 
62
  # PREFIX LANGUAGE MODELING
 
43
  import torch
44
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
45
 
46
+ tokenizer = AutoTokenizer.from_pretrained("ltg/nort5-base", trust_remote_code=True)
47
+ model = AutoModelForSeq2SeqLM.from_pretrained("ltg/nort5-base", trust_remote_code=True)
48
 
49
 
50
  # MASKED LANGUAGE MODELING
51
 
52
+ sentence = "Brukseksempel: Elektrisk oppvarming. Definisjonen på ordet oppvarming er: å[MASK_0]."
53
  encoding = tokenizer(sentence)
54
 
55
  input_tensor = torch.tensor([encoding.input_ids])
56
  output_tensor = model.generate(input_tensor, decoder_start_token_id=7, eos_token_id=8)
57
  tokenizer.decode(output_tensor.squeeze(), skip_special_tokens=True)
58
 
59
+ # should output: ' varme opp et rom.'
60
 
61
 
62
  # PREFIX LANGUAGE MODELING