You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When executing the following adapted example code given in querying/README.md
importtorchimportdl2libasdl2importdl2lib.queryasqfromconfigargparseimportArgumentParserfromquerying.models.mnist.mainimportNet1my_pytorch_model=Net1()
my_pytorch_model.load_state_dict(torch.load('models/mnist/mnist_1.pt'))
defhigh_level_query():
qtext="""FIND i[10] S.T. i[0] + i[3] < NN(i[4])"""# actualy querycontext=dict() # a python dict that defines models and named constantscontext['NN'] =my_pytorch_modelparser=ArgumentParser(description='DL2 Querying')
parser=dl2.add_default_parser_args(parser, query=True)
args=parser.parse_args() # additionaly arguments such as timeout etc.success, result, time=q.Query(qtext, context=context, args=args).run()
if__name__=='__main__':
high_level_query()
the following error occurs:
Traceback (most recent call last):
File "~/dl2-master/querying/example_query.py", line 36, in <module>
variant1()
File "~/dl2-master/querying/example_query.py", line 21, in variant1
success, result, time = q.Query(qtext, context=context, args=args).run()
File "~/dl2-master/dl2lib/query/query.py", line 11, in __init__
self.constraint, self.return_values = Parser(query, self.context, self.args).parse()
File "~/dl2-master/dl2lib/query/parser.py", line 42, in parse
return self.generate_find()
File "~/dl2-master/dl2lib/query/parser.py", line 50, in generate_find
constraints = self.traverse_constraints(self.parse_tree.find.constraints.constraints)
File "~/dl2-master/dl2lib/query/parser.py", line 153, in traverse_constraints
c1 = self.traverse_constraint(constraint.c1)
File "~/dl2-master/dl2lib/query/parser.py", line 137, in traverse_constraint
lhs = self.traverse_expression(constraint.lhs)
File "~/dl2-master/dl2lib/query/parser.py", line 127, in traverse_expression
return eval(f"lhs {exp.op} rhs")
File "<string>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'NoneType' and 'Fn'
The model mnist_1.pt was trained using the given training procedure train_models.sh from the querying directory.
The text was updated successfully, but these errors were encountered:
When executing the following adapted example code given in querying/README.md
the following error occurs:
The model mnist_1.pt was trained using the given training procedure train_models.sh from the querying directory.
The text was updated successfully, but these errors were encountered: