nbroad HF staff commited on
Commit
345863f
1 Parent(s): df4a81d

change return_tensors to "np" for flax example

Browse files
Files changed (1) hide show
  1. README.md +3 -23
README.md CHANGED
@@ -64,16 +64,7 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
64
  tokenizer = AutoTokenizer.from_pretrained("nbroad/mt5-small-qgen")
65
  model = AutoModelForSeq2SeqLM.from_pretrained("nbroad/mt5-small-qgen", from_flax=True)
66
 
67
- text = "Hugging Face has seen rapid growth in its \
68
- popularity since the get-go. It is definitely doing\
69
- the right things to attract more and more people to \
70
- its platform, some of which are on the following lines:\
71
- Community driven approach through large open source repositories \
72
- along with paid services. Helps to build a network of like-minded\
73
- people passionate about open source. \
74
- Attractive price point. The subscription-based features, e.g.: \
75
- Inference based API, starts at a price of $9/month.\
76
- "
77
 
78
  inputs = tokenizer(text, return_tensors="pt")
79
  output = model.generate(**inputs, max_length=40)
@@ -89,20 +80,9 @@ from transformers import AutoTokenizer, FlaxAutoModelForSeq2SeqLM
89
  tokenizer = AutoTokenizer.from_pretrained("nbroad/mt5-small-qgen")
90
  model = FlaxAutoModelForSeq2SeqLM.from_pretrained("nbroad/mt5-small-qgen")
91
 
92
- text = "A un año y tres días de que el balón ruede \
93
- en el Al Bayt Stadium inaugurando el Mundial 2022, \
94
- ya se han dibujado los primeros bocetos de la próxima \
95
- Copa del Mundo.13 selecciones están colocadas en el \
96
- mapa con la etiqueta de clasificadas y tienen asegurado\
97
- pisar los verdes de Qatar en la primera fase final \
98
- otoñal. Serbia, Dinamarca, España, Países Bajos, \
99
- Suiza, Croacia, Francia, Inglaterra, Bélgica, Alemania,\
100
- Brasil, Argentina y Qatar, como anfitriona, entrarán en \
101
- el sorteo del 1 de abril de 2022 en Doha en el que 32 \
102
- países serán repartidos en sus respectivos grupos. \
103
- "
104
 
105
- inputs = tokenizer(text, return_tensors="pt")
106
  output = model.generate(**inputs, max_length=40)
107
 
108
  tokenizer.decode(output["sequences"][0], skip_special_tokens=True)
 
64
  tokenizer = AutoTokenizer.from_pretrained("nbroad/mt5-small-qgen")
65
  model = AutoModelForSeq2SeqLM.from_pretrained("nbroad/mt5-small-qgen", from_flax=True)
66
 
67
+ text = "Hugging Face has seen rapid growth in its \npopularity since the get-go. It is definitely doing\n the right things to attract more and more people to \n its platform, some of which are on the following lines:\nCommunity driven approach through large open source repositories \nalong with paid services. Helps to build a network of like-minded\n people passionate about open source. \nAttractive price point. The subscription-based features, e.g.: \nInference based API, starts at a price of $9/month.\n"
 
 
 
 
 
 
 
 
 
68
 
69
  inputs = tokenizer(text, return_tensors="pt")
70
  output = model.generate(**inputs, max_length=40)
 
80
  tokenizer = AutoTokenizer.from_pretrained("nbroad/mt5-small-qgen")
81
  model = FlaxAutoModelForSeq2SeqLM.from_pretrained("nbroad/mt5-small-qgen")
82
 
83
+ text = "A un año y tres días de que el balón ruede \nen el Al Bayt Stadium inaugurando el Mundial 2022, \nya se han dibujado los primeros bocetos de la próxima \nCopa del Mundo.13 selecciones están colocadas en el \nmapa con la etiqueta de clasificadas y tienen asegurado\n pisar los verdes de Qatar en la primera fase final \n otoñal. Serbia, Dinamarca, España, Países Bajos, \n Suiza, Croacia, Francia, Inglaterra, Bélgica, Alemania,\n Brasil, Argentina y Qatar, como anfitriona, entrarán en \n el sorteo del 1 de abril de 2022 en Doha en el que 32 \n países serán repartidos en sus respectivos grupos. \n"
 
 
 
 
 
 
 
 
 
 
 
84
 
85
+ inputs = tokenizer(text, return_tensors="np")
86
  output = model.generate(**inputs, max_length=40)
87
 
88
  tokenizer.decode(output["sequences"][0], skip_special_tokens=True)