We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5be07e4 commit 17fe183Copy full SHA for 17fe183
paddlenlp/data/vocab.py
@@ -200,10 +200,10 @@ def to_tokens(self, indices):
200
if not isinstance(indices, (list, tuple, np.ndarray)):
201
indices = [indices]
202
to_reduce = True
203
- elif isinstance(indices, (list, tuple)):
+ if isinstance(indices, (list, tuple)):
204
indices = np.asarray(indices)
205
206
- if len(indices.shape) > 1:
+ if isinstance(indices, (np.ndarray)) and len(indices.shape) > 1:
207
raise ValueError(
208
'Token indices is invalid. Expected 1D array, but received {}D array. '.
209
format(len(indices.shape)))
0 commit comments