Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: slice indices must be integers or None or have an __index__ method #6

Open
SeekPoint opened this issue Jul 20, 2017 · 1 comment

Comments

@SeekPoint
Copy link

mldl@mldlUB1604:/ub16_prj/holographic-embeddings$ bash run_transe_wn18.sh
INFO:EX-KG:Fitting model TransE with trainer PairwiseStochasticTrainer and parameters Namespace(fin='data/wn18.bin', fout=None, init='nunif', lr=0.1, margin=2.0, me=500, mode='rank', nb=100, ncomp=50, ne=1, no_pairwise=False, sampler='random-mode', test_all=50)
Traceback (most recent call last):
File "kg/run_transe.py", line 41, in
ExpTransE().run()
File "/home/mldl/ub16_prj/holographic-embeddings/kg/base.py", line 50, in run
self.train()
File "/home/mldl/ub16_prj/holographic-embeddings/kg/base.py", line 154, in train
trn.fit(xs, ys)
File "/usr/local/lib/python3.5/dist-packages/scikit_kge-0.1-py3.5.egg/skge/base.py", line 197, in fit
scores_o = self.scores_o(mdl, s, p).flatten()
File "/usr/local/lib/python3.5/dist-packages/scikit_kge-0.1-py3.5.egg/skge/base.py", line 142, in _optim
sampler = sample.RandomModeSampler(self.args.ne, [0, 1], xs, sz)
File "/usr/local/lib/python3.5/dist-packages/numpy/lib/shape_base.py", line 509, in split
res = array_split(ary, indices_or_sections, axis)
File "/usr/local/lib/python3.5/dist-packages/numpy/lib/shape_base.py", line 430, in array_split
sub_arys.append(_nx.swapaxes(sary[st:end], axis, 0))
TypeError: slice indices must be integers or None or have an index method
mldl@mldlUB1604:
/ub16_prj/holographic-embeddings$

@StevenLOL
Copy link

in scikit-skge/skge/base.py line 130

change

self.batch_size = np.ceil(len(xys) / self.nbatches)

to

self.batch_size = np.int(np.ceil(len(xys) / self.nbatches))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants