scallop-lang / scallop Goto Github PK
View Code? Open in Web Editor NEWFramework and Language for Neurosymbolic Programming. Join Our Discord: https://discord.gg/RavzdND229
Home Page: https://www.scallop-lang.org
License: MIT License
Framework and Language for Neurosymbolic Programming. Join Our Discord: https://discord.gg/RavzdND229
Home Page: https://www.scallop-lang.org
License: MIT License
I tried to install Scallopy, but encountered the following issue:
(clip) ql@dcd222:~/repos/scallop/etc/scallopy$ make
maturin develop --release
๐น Building a mixed python/rust project
๐ Found pyo3 bindings
๐ Found CPython 3.9 at /home/ql/anaconda3/envs/clip/bin/python
Compiling scallop-core v0.1.9 (/home/ql/repos/scallop/core)
Building [=======================> ] 215/218: scallop-core error[E0554]: `#![feature]` may not be used on the stable release channel
--> core/src/lib.rs:1:1
|
1 | #![feature(min_specialization)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Building error[E0554]: `#![feature]` may not be used on the stable release channel
--> core/src/lib.rs:2:1
|
2 | #![feature(drain_filter)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
[=======================> ] 215/218: scallop-core
error[E0554]: `#![feature]` may not be used on the stable release channel
--> core/src/lib.rs:2:12
|
2 | #![feature(drain_filter)]
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'map_first_last'
--> core/src/compiler/front/analyzers/type_inference/local.rs:271:67
|
271 | .map(|(var, exprs)| (var.clone(), inferred_expr_types[exprs.first().unwrap()].clone()))
| ^^^^^
|
= note: see issue #62924 <https://github.com/rust-lang/rust/issues/62924> for more information
error[E0658]: use of unstable library feature 'map_first_last'
--> core/src/compiler/ram/incremental.rs:23:31
|
23 | let (s1, n1) = fringe_1.pop_first().unwrap();
| ^^^^^^^^^
|
= note: see issue #62924 <https://github.com/rust-lang/rust/issues/62924> for more information
error[E0658]: use of unstable library feature 'map_first_last'
--> core/src/compiler/ram/incremental.rs:24:31
|
24 | let (s2, n2) = fringe_2.pop_first().unwrap();
| ^^^^^^^^^
|
= note: see issue #62924 <https://github.com/rust-lang/rust/issues/62924> for more information
error[E0658]: use of unstable library feature 'map_first_last'
--> core/src/compiler/ram/incremental.rs:91:31
|
91 | let (s1, n1) = fringe_1.pop_first().unwrap();
| ^^^^^^^^^
|
= note: see issue #62924 <https://github.com/rust-lang/rust/issues/62924> for more information
Buildingerror[E0658]: use of unstable library feature 'map_first_last'
--> core/src/compiler/ram/incremental.rs:92:31
|
92 | let (s2, n2) = fringe_2.pop_first().unwrap();
| ^^^^^^^^^
|
= note: see issue #62924 <https://github.com/rust-lang/rust/issues/62924> for more information
error[E0658]: use of unstable library feature 'map_first_last'
--> core/src/runtime/provenance/common/disjunction.rs:22:29
|
22 | let j_last = self.facts.last().unwrap(); // Note: disj.len >= 2
| ^^^^
|
= note: see issue #62924 <https://github.com/rust-lang/rust/issues/62924> for more information
error[E0658]: use of unstable library feature 'map_first_last'
--> core/src/runtime/provenance/common/disjunction.rs:23:30
|
23 | let j_first = self.facts.first().unwrap(); // Note: disj.len >= 2
| ^^^^^
|
= note: see issue #62924 <https://github.com/rust-lang/rust/issues/62924> for more information
error[E0658]: use of unstable library feature 'map_first_last'
--> core/src/runtime/provenance/common/disjunction.rs:24:24
|
24 | let f_last = facts.last().unwrap(); // Note: facts.len >= 2
| ^^^^
|
= note: see issue #62924 <https://github.com/rust-lang/rust/issues/62924> for more information
Buildingerror[E0658]: use of unstable library feature 'map_first_last'
--> core/src/runtime/provenance/common/disjunction.rs:25:25
|
25 | let f_first = facts.first().unwrap(); // Note: facts.len >= 2
| ^^^^^
|
= note: see issue #62924 <https://github.com/rust-lang/rust/issues/62924> for more information
error: aborting due to 12 previous errors
Building
Some errors have detailed explanations: E0554, E0658.
For more information about an error, try `rustc --explain E0554`.
error: could not compile `scallop-core` due to 13 previous errors
๐ฅ maturin failed
Caused by: Failed to build a native library through cargo
Caused by: Cargo build finished with "exit status: 101": `PYO3_ENVIRONMENT_SIGNATURE="cpython-3.9-64bit" PYO3_PYTHON="/home/ql/anaconda3/envs/clip/bin/python" PYTHON_SYS_EXECUTABLE="/home/ql/anaconda3/envs/clip/bin/python" "cargo" "rustc" "--release" "--manifest-path" "/home/ql/repos/scallop/etc/scallopy/Cargo.toml" "--message-format" "json" "--lib"`
make: *** [makefile:2: all] Error 1
I tried both a stable version and a nightly version of rustc, however it still failed.
Encountered the following issue when trying to build Scallop:
(scallop-lab) ql@dcd222:~/repos/scallop/etc/scallopy$ make
maturin develop --release
๐น Building a mixed python/rust project
๐ Found pyo3 bindings
๐ Found CPython 3.8 at /home/ql/anaconda3/envs/scallop-lab/bin/python
warning: /home/ql/repos/scallop/etc/scallopy/Cargo.toml: unused manifest key: package.default
Compiling pyo3-ffi v0.18.3
Compiling pyo3 v0.18.3
Compiling scallop-core v0.1.8 (/home/ql/repos/scallop/core)
error: failed to run custom build command for `scallop-core v0.1.8 (/home/ql/repos/scallop/core)`
Caused by:
process didn't exit successfully: `/home/ql/repos/scallop/target/release/build/scallop-core-4685a492c91fb3f6/build-script-build` (exit status: 1)
--- stdout
processing file `./src/compiler/front/grammar.lalrpop`
./src/compiler/front/grammar.lalrpop:110:3: 110:35 error: invalid regular expression: regex parse error:
-?\d+(\.\d+)(e-?\d+)?
^^
error: Unicode-aware Perl class not found (make sure the unicode-perl feature is enabled)
--- stderr
r"-?\d+(\.\d+)(e-?\d+)?" => float,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: build failed, waiting for other jobs to finish...
๐ฅ maturin failed
Caused by: Failed to build a native library through cargo
Caused by: Cargo build finished with "exit status: 101": `PYO3_ENVIRONMENT_SIGNATURE="cpython-3.8-64bit" PYO3_PYTHON="/home/ql/anaconda3/envs/scallop-lab/bin/python" PYTHON_SYS_EXECUTABLE="/home/ql/anaconda3/envs/scallop-lab/bin/python" "cargo" "rustc" "--release" "--manifest-path" "/home/ql/repos/scallop/etc/scallopy/Cargo.toml" "--message-format" "json" "--lib"`
make: *** [makefile:2: all] Error 1
Suppose I have a relation "target", where target(a, b) = P
, e.g., target(0, 2) = 0.64
, then how should I define a rule to calculate a new relation "answer", such that answer(a, b) = P^(1/(b-a))
, e.g., answer(0, 2) = 0.64^(1/2) = 0.8
?
Example with provided custom provenance (diffaddmultprob2
):
import scallopy
import torch
from logic_classifier import DiffMlnProbSemiring
ctx = scallopy.ScallopContext(provenance="diffaddmultprob2")
ctx.add_relation("digit_1", int, list(range(10)))
ctx.add_relation("digit_2", int, list(range(10)))
ctx.add_rule("sum_2(a + b) = digit_1(a), digit_2(b)")
sum_2 = ctx.forward_function("sum_2", list(range(19)), dispatch="parallel")
digit_1 = torch.randn((16, 10))
digit_2 = torch.randn((16, 10))
result = sum_2(digit_1=digit_1, digit_2=digit_2)
print(result)
Running this script hangs forever... It's not a big deal, as dispatch="single" still works. I guess pyo3
may have some concurrency issue, though I did not verify anything.
Hi, I'm trying to define a relation that can apply operations like adding a prefix or suffix to a input word, the different operations would also be defined in a relation.
ctx = scallopy.ScallopContext("difftopkproofs")
ctx.add_relation("opr", str, input_mapping=["pref", "suf"])
ctx.add_relation("word1", str)
ctx.add_relation("word2", str)
ctx.add_rule("add_pref(w2+w1)) :- word1(w1), opr("pref"), word2(w2)")
ctx.add_rule("add_suf(w1+w2) :- word1(w1), opr("suf"), word2(w2)")
However, when I run I got an error saying opr takes no argument(expected 1), can you explain where went wrong? Thanks
Hello,
Thank you for developing this great package. Would it be possible to get support for Rhel 7 Linux distribution with GLIBIC under 2.14?
Thank you for your time.
When attempting to install Scallop's scli
on an M1 Mac, as well as on a x86-system, I have in both instances hit the following error:
error[E0635]: unknown feature `drain_filter`
--> core/src/lib.rs:2:12
|
2 | #![feature(drain_filter)]
| ^^^^^^^^^^^^
error[E0599]: no method named `drain_filter` found for struct `Vec<NegativeDataflow>` in the current scope
--> core/src/compiler/back/b2r.rs:126:10
|
125 | let curr_neg_dfs = negative_dataflows
| __________________________-
126 | | .drain_filter(|ndf| ndf.sources.is_subset(&accumulated_sources))
| | -^^^^^^^^^^^^ method not found in `Vec<NegativeDataflow>`
| |_________|
|
Some errors have detailed explanations: E0599, E0635.
For more information about an error, try `rustc --explain E0599`.
error: could not compile `scallop-core` (lib) due to 2 previous errors
error: failed to compile `scli v0.1.9 (/local/temp/Scallop-Devving/scallop/etc/scli)`, intermediate artifacts can be found at `/local/temp/Scallop-Devving/scallop/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
make: *** [makefile:5: install-scli] Error 101
In both instances the use of Rust's nightly repositories is set up correctly, and the right compilers seem to be used.
Hi,
I can't seem to run a scallop program?
โฏ ls
hello1.scl hello.scl scli
โฏ ./scli --help
sclrepl 0.1.4
Scallop Interactive REPL
USAGE:
scli [FLAGS] [OPTIONS]
FLAGS:
-d, --debug
--debug-back
--debug-front
--debug-ram
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-p, --provenance <provenance> [default: unit]
โฏ cat hello.scl
// hello.scl
rel hello = {"Hello World"}
โฏ ./scli ./hello.scl
error: Found argument './hello.scl' which wasn't expected, or isn't valid in this context
USAGE:
scli [FLAGS] [OPTIONS]
For more information try --help
OS: Ubuntu 22.04
The instructions in the README seem to fail on Mac OS. All of the make invocations in the readme, as well as invocations of cargo install
fail with
$ make install-sclc
cargo install --path etc/sclc
error: failed to parse manifest at `/Users/ammkrn/rust/scallop/etc/sclc/Cargo.toml`
Caused by:
found duplicate binary name sclc, but all binary targets must have a unique name
make: *** [install-sclc] Error 101
Info:
rustc 1.68.0-nightly (333ee6c46 2023-01-18)
Big Sur 11.7.1
GNU Make 3.81
Hi,
At 'https://scallop-lang.github.io/tutorial.html', I see two different syntax for rules
first is :-
:
self.scl_ctx.add_rule("sum_2(a + b) :- digit_1(a), digit_2(b)")
and =
:
ctx.add_rule("sum_2(a + b) = digit_1(a), digit_2(b)")
Are they semantically the same? Can they be used interchangeably?
I am trying to pip install using
pip install https://github.com/scallop-lang/scallop/releases/download/0.1.4/scallopy-0.1.4-cp39-cp39-manylinux_2_27_x86_64.whl
ERROR: scallopy-0.1.4-cp39-cp39-manylinux_2_27_x86_64.whl is not a supported wheel on this platform.
uname -a
Linux evc1 3.10.0-1127.el7.x86_64
python --version
Python 3.9.18
When I try to compile from the source I get the following error:
error[E0554]: #![feature]
may not be used on the stable release channel
--> core/src/lib.rs:1:1
|
1 | #![feature(min_specialization)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0554]: #![feature]
may not be used on the stable release channel
--> core/src/lib.rs:2:1
|
2 | #![feature(extract_if)]
| ^^^^^^^^^^^^^^^^^^^^^^^
error[E0554]: #![feature]
may not be used on the stable release channel
--> core/src/lib.rs:3:1
|
3 | #![feature(hash_extract_if)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0554]: #![feature]
may not be used on the stable release channel
--> core/src/lib.rs:4:1
|
4 | #![feature(proc_macro_span)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0554]: #![feature]
may not be used on the stable release channel
--> core/src/lib.rs:2:12
|
2 | #![feature(extract_if)]
| ^^^^^^^^^^
error[E0554]: #![feature]
may not be used on the stable release channel
--> core/src/lib.rs:3:12
|
3 | #![feature(hash_extract_if)]
| ^^^^^^^^^^^^^^^
error[E0554]: #![feature]
may not be used on the stable release channel
--> core/src/lib.rs:4:12
|
4 | #![feature(proc_macro_span)]
| ^^^^^^^^^^^^^^^
For more information about this error, try rustc --explain E0554
.
The ability to use GraphML as the input format would increase interoperability with Python and encourage the use of standard libraries.
Hello,
I was wondering if it's possible to make a query with a KB in scallopy in which you simply get a True/False or Yes/No answer. For example, within the tutorial, what if I want to check whether a path exists between two nodes without having to list out all of the paths?
Such as path(0,4)
Thank you in advance.
During container build a notice comes up the sklearn
is deprecated. Change to scikit-learn
From the dockerfile here pointed to by the tutorials: https://www.scallop-lang.org/ssft22/labs/Dockerfile
The hyperlink just points to https://repository.upenn.edu/home.
Can you give the correct reference?
Thanks!
The new version of make develop-scallop-cli
yields the following error running any scl file:
Traceback (most recent call last):
File "<DIR>/local/anaconda3/envs/scallop_env/bin/scallop", line 8, in <module>
sys.exit(main())
File "<DIR>/research/scallop/etc/scallop-cli/scallop/cli.py", line 148, in main
args, unknown_args = cmd_args(plugin_registry)
File "<DIR>/research/scallop/etc/scallop-cli/scallop/cli.py", line 44, in cmd_args
parser = argument_parser(plugin_registry)
File "<DIR>/research/scallop/etc/scallop-cli/scallop/cli.py", line 37, in argument_parser
plugin_registry.setup_argument_parser(parser)
File "<DIR>/research/scallop/etc/scallopy-ext/src/scallopy_ext/registry.py", line 30, in setup_argument_parser
setup_fn(parser)
File "<DIR>/research/scallop-v2/etc/scallopy-plugins/clip/src/scallop_clip/config.py", line 12, in setup_arg_parser
parser.add_argument("--clip-model-checkpoint", type=str, default=_DEFAULT_CLIP_MODEL_CHECKPOINT)
File "<DIR>/local/anaconda3/envs/scallop_env/lib/python3.10/argparse.py", line 1436, in add_argument
return self._add_action(action)
File "<DIR>/local/anaconda3/envs/scallop_env/lib/python3.10/argparse.py", line 1801, in _add_action
self._optionals._add_action(action)
File "<DIR>/local/anaconda3/envs/scallop_env/lib/python3.10/argparse.py", line 1638, in _add_action
action = super(_ArgumentGroup, self)._add_action(action)
File "<DIR>/local/anaconda3/envs/scallop_env/lib/python3.10/argparse.py", line 1450, in _add_action
self._check_conflict(action)
File "<DIR>/local/anaconda3/envs/scallop_env/lib/python3.10/argparse.py", line 1587, in _check_conflict
conflict_handler(action, confl_optionals)
File "<DIR>/local/anaconda3/envs/scallop_env/lib/python3.10/argparse.py", line 1596, in _handle_conflict_error
raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --clip-model-checkpoint: conflicting option string: --clip-model-checkpoint
Hi, we are building a customized provenance. While implementing all required functions instructed in provenance.py, we were stubbed by error messages like
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: PyErr { type: <class 'AttributeError'>, value: AttributeError("'CustomProbabilityProvenance' object has no attribute 'tagging_fn'"), traceback: None }
Three of them are tagging_fn
, recovery_fn
, and discard
. We had to implement them without readily knowing what they are for.
This error can also be reproduced by running the provided examples that contain customizing a provenance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.