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

Calling bayesflow from R #218

Closed
marvinschmitt opened this issue Oct 18, 2024 · 1 comment · May be fixed by #230
Closed

Calling bayesflow from R #218

marvinschmitt opened this issue Oct 18, 2024 · 1 comment · May be fixed by #230
Assignees
Labels
user interface Changes to the user interface and improvements in usability

Comments

@marvinschmitt
Copy link
Member

No description provided.

@marvinschmitt marvinschmitt converted this from a draft issue Oct 18, 2024
@marvinschmitt marvinschmitt added user interface Changes to the user interface and improvements in usability v2 labels Oct 18, 2024
@eodole
Copy link
Collaborator

eodole commented Oct 18, 2024

Commit : 60a2fca
Issue:
This issue is in reference to the two_moons.rmd in the r-notebook branch, where we are trying to recreate the two moons tutorial in R via the package reticulate.

R stores all numbers as float64 where as tensorflow in python wants to have a float32. I tried changing the forward model function so that it would explicitly generate float32, but when it is called later by another function to sample training data, the training data which is stored in R, is in the default number type float64.

Tried:
history <- approximator$fit( epochs = 3L, dataset = training_dataset, validation_data = validation_dataset )

Full Error:

tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute Mul as input #1(zero-based) was expected to be a float tensor but is a double tensor [Op:Mul] name: 
Run `reticulate::py_last_error()` for details.

9.
stop(structure(list(message = "tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute Mul as input #1(zero-based) was expected to be a float tensor but is a double tensor [Op:Mul] name: \n\033[90mRun \033]8;;rstudio:run:reticulate::py_last_error()\a`reticulate::py_last_error()`\033]8;;\a for details.\033[39m", 
call = py_call_impl(callable, call_args$unnamed, call_args$named)), class = c("tensorflow.python.framework.errors_impl.InvalidArgumentError", 
"tensorflow.python.framework.errors_impl.OpError", "python.builtin.Exception", 
"python.builtin.BaseException", "python.builtin.object", "error", ...

8.
raise_from_not_ok_status at ops.py#5983

7.
error_handler at traceback_utils.py#153

6.
compute_metrics at flow_matching.py#117

5.
compute_metrics at continuous_approximator.py#95

4.
build_from_data at approximator.py#23

3.
fit at approximator.py#82

2.
fit at continuous_approximator.py#109

1.
approximator$fit(epochs = 3L, dataset = training_dataset, validation_data = validation_dataset)```

@LarsKue LarsKue closed this as completed Oct 24, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in bayesflow development Oct 24, 2024
@marvinschmitt marvinschmitt linked a pull request Oct 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user interface Changes to the user interface and improvements in usability
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants