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

Error when generating data #1

Open
YuCheng-Qi opened this issue Sep 15, 2023 · 1 comment
Open

Error when generating data #1

YuCheng-Qi opened this issue Sep 15, 2023 · 1 comment

Comments

@YuCheng-Qi
Copy link

When I run the above code according to the documentation, the error is as follows:
Trainable params 1284
Start training for 4000 iterations with 9 constants
Traceback (most recent call last):
File "HRI/Grandparent.py", line 47, in
exp.run()
File "/Users/weed/PycharmProjects/hierarchical-rule-induction/HRI/utils/Learn.py", line 167, in run
train_acc_rate, embeddings_temporal, unifs_temporal, losses, valuation, unifs, train_iters = model.train(
File "/Users/weed/PycharmProjects/hierarchical-rule-induction/HRI/utils/coreModel.py", line 378, in train
valuation_init, target = self.data_generator.getData(
File "/Users/qiyucheng/weed/hierarchical-rule-induction/HRI/utils/Dataset.py", line 53, in getData
relations = randomly_generate_family(num_constants,
File "/Users/weed/PycharmProjects/hierarchical-rule-induction/HRI/utils/Family.py", line 172, in randomly_generate_family
parents = random.choice(couples)
File "mtrand.pyx", line 920, in numpy.random.mtrand.RandomState.choice
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

@claireaoi
Copy link
Owner

I apologize for the delay.

Unfortunately I can not reproduce the error, could you tell me more about your setup? It could be due to a library issue.

I now tested it with python 3.9.7
numpy==1.23.0
torch==1.12.0
torchtext==0.13.0

(alternatively you can use more recent versions for instance
torch==2.1.2
torchtext==0.16.2, I tried also)

Are you using a command like:
python HRI/Grandparent.py --num_iters=4000 --num_runs=2 --recursivity=full --max_depth=4 --num_feat=0 --use_gpu=False

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