junnyu commited on
Commit
1fe77fb
1 Parent(s): 9d35978
Files changed (1) hide show
  1. README.md +4 -4
README.md CHANGED
@@ -32,7 +32,7 @@ for i, id in enumerate(tokenizer.encode(text)):
32
  pt_outputs_sentence += "".join(
33
  tokenizer.convert_ids_to_tokens([id], skip_special_tokens=True))
34
  print(pt_outputs_sentence)
35
- # pytorch 今天[天气||天||心情||阳光||空气]很好,我[想||要||打算||准备||喜欢]去公园玩。
36
  ```
37
 
38
  ## tensorflow2.0使用
@@ -40,8 +40,8 @@ print(pt_outputs_sentence)
40
  import tensorflow as tf
41
  from transformers import RoFormerTokenizer, TFRoFormerForMaskedLM
42
  text = "今天[MASK]很好,我[MASK]去公园玩。"
43
- tokenizer = RoFormerTokenizer.from_pretrained("junnyu/roformer_chinese_base")
44
- tf_model = TFRoFormerForMaskedLM.from_pretrained("junnyu/roformer_chinese_base")
45
  tf_inputs = tokenizer(text, return_tensors="tf")
46
  tf_outputs = tf_model(**tf_inputs, training=False).logits[0]
47
  tf_outputs_sentence = "tf2.0: "
@@ -54,7 +54,7 @@ for i, id in enumerate(tokenizer.encode(text)):
54
  tf_outputs_sentence += "".join(
55
  tokenizer.convert_ids_to_tokens([id], skip_special_tokens=True))
56
  print(tf_outputs_sentence)
57
- # tf2.0 今天[天气||天||心情||阳光||空气]很好,我[想||要||打算||准备||喜欢]去公园玩。
58
  ```
59
 
60
  ## 引用
 
32
  pt_outputs_sentence += "".join(
33
  tokenizer.convert_ids_to_tokens([id], skip_special_tokens=True))
34
  print(pt_outputs_sentence)
35
+ # pytorch: 今天[天||气||都||风||人]很好,我[想||要||就||也||还]去公园玩。
36
  ```
37
 
38
  ## tensorflow2.0使用
 
40
  import tensorflow as tf
41
  from transformers import RoFormerTokenizer, TFRoFormerForMaskedLM
42
  text = "今天[MASK]很好,我[MASK]去公园玩。"
43
+ tokenizer = RoFormerTokenizer.from_pretrained("junnyu/roformer_chinese_char_base")
44
+ tf_model = TFRoFormerForMaskedLM.from_pretrained("junnyu/roformer_chinese_char_base")
45
  tf_inputs = tokenizer(text, return_tensors="tf")
46
  tf_outputs = tf_model(**tf_inputs, training=False).logits[0]
47
  tf_outputs_sentence = "tf2.0: "
 
54
  tf_outputs_sentence += "".join(
55
  tokenizer.convert_ids_to_tokens([id], skip_special_tokens=True))
56
  print(tf_outputs_sentence)
57
+ # tf2.0 今天[天||气||都||风||人]很好,我[想||要||就||也||还]去公园玩。
58
  ```
59
 
60
  ## 引用