mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
Allow vector loading to work on 1d data files. Fixes #1831
This commit is contained in:
parent
00557c5fdd
commit
29897ed1b3
|
@ -310,6 +310,8 @@ cdef class Vectors:
|
||||||
self.data = xp.fromfile(file_, dtype=dtype)
|
self.data = xp.fromfile(file_, dtype=dtype)
|
||||||
if dtype != 'float32':
|
if dtype != 'float32':
|
||||||
self.data = xp.ascontiguousarray(self.data, dtype='float32')
|
self.data = xp.ascontiguousarray(self.data, dtype='float32')
|
||||||
|
if self.data.ndim == 1:
|
||||||
|
self.data = self.data.reshape((self.data.size//width, width))
|
||||||
n = 0
|
n = 0
|
||||||
strings = StringStore()
|
strings = StringStore()
|
||||||
with (path / 'vocab.txt').open('r') as file_:
|
with (path / 'vocab.txt').open('r') as file_:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user