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

Erreur dans UseMethod("compile") #1436

Closed
OusmaneS17 opened this issue Apr 23, 2024 · 7 comments
Closed

Erreur dans UseMethod("compile") #1436

OusmaneS17 opened this issue Apr 23, 2024 · 7 comments

Comments

@OusmaneS17
Copy link

Bonjour, j'ai construit un modèle en utilisant keras mais j'ai eu une erreur de compilation comme celle-ci:
model <- keras_model(inputs = input_layer, outputs = list(output_revenu, output_data, output_voix))

summary(model)

> model <- compile( + model, + optimizer = optimizer_adam(), + loss = "mean_squared_error", + metrics = list("mean_squared_error"), + loss_weights = list(output_revenu = 1, output_data = 1, output_voix = 1) + ) Erreur dans UseMethod("compile") : pas de méthode pour 'compile' applicable pour un objet de classe "c('keras.src.models.functional.Functional', 'keras.models.functional.Functional', 'keras.src.ops.function.Function', 'keras.ops.function.Function', 'keras.src.models.model.Model', 'keras.models.model.Model', 'keras.src.backend.tensorflow.trainer.TensorFlowTrainer', 'keras.backend.tensorflow.trainer.TensorFlowTrainer', 'keras.src.trainers.trainer.Trainer', 'keras.trainers.trainer.Trainer', 'keras.src.layers.layer.Layer', 'keras.layers.layer.Layer', 'keras.src.backend.tensorflow.layer.TFLayer', 'keras.backend.tensorflow.layer.TFLayer', 'keras.src.backend.tensorflow.trackable.KerasAutoTrackable', 'keras.backend.tensorflow.trackable.KerasAutoTrackable', 'tensorflow.python.trackable.autotrackable.AutoTrackable', 'tensorflow.python.trackable.base.Trackable', 'keras.src.ops.operation.Operation', 'keras.ops.operation.Operation', 'python.builtin.object')"
@t-kalinowski
Copy link
Member

Hello, we are only able to provide support in English. Can you please update your post to English? Using something like https://translate.google.com might be helpful.

@OusmaneS17
Copy link
Author

hello,

I built a model using keras but got a compilation error like this:
model <- keras_model(inputs = input_layer, outputs = list(output_revenue, output_data, output_voice))

summary (template)

model <- compile( + model, + optimizer = optimizer_adam(), + loss = "mean_squared_error", + metrics = list("mean_squared_error"), + loss_weights = list(output_revenue = 1, output_data = 1, output_voice = 1) + ) Error in UseMethod("compile"): no method for 'compile' applicable for an object of class "c('keras.src.models.functional.Functional', 'keras.models.functional.Functional', ' keras.src.ops.function.Function', 'keras.ops.function.Function', 'keras.src.models.model.Model', 'keras.models.model.Model', 'keras.src.backend. tensorflow.trainer.TensorFlowTrainer', 'keras.backend.tensorflow.trainer.TensorFlowTrainer', 'keras.src.trainers.trainer.Trainer', 'keras.trainers.trainer.Trainer', 'keras.src.layers.layer. Layer', 'keras.layers.layer.Layer', 'keras.src.backend.tensorflow.layer.TFLayer', 'keras.backend.tensorflow.layer.TFLayer', 'keras.src.backend.tensorflow.trackable. KerasAutoTrackable', 'keras.backend.tensorflow.trackable.KerasAutoTrackable', 'tensorflow.python.trackable.autotrackable.AutoTrackable', 'tensorflow.python.trackable.base.Trackable', 'keras.src.ops.operation.Operation' , 'keras.ops.operation.Operation', 'python.builtin.object')"

@t-kalinowski
Copy link
Member

Is this with keras or keras3?

Can you please provide a reprex?

The error message looks very similar to an issue that occurred if both R packages {keras} and {keras3} were loaded in the same R session. That issue is now fixed with the latest CRAN release of both packages. Can you confirm you're using the latest CRAN release?

@OusmaneS17
Copy link
Author

OusmaneS17 commented Apr 25, 2024 via email

@t-kalinowski
Copy link
Member

t-kalinowski commented Apr 25, 2024

Hello, I don't believe github supports email replies with attachments. Can you please paste the output from running reprex::reprex() into the issue thread using the github UI: #1436

@OusmaneS17
Copy link
Author

reprex::reprex()
#> ℹ Non-interactive session, setting html_preview = FALSE.
#> CLIPR_ALLOW has not been set, so clipr will not run interactively
#> Error in switch(where, expr = stringify_expression(x_expr), clipboard = ingest_clipboard(), : EXPR doit être un vecteur de longueur 1

Created on 2024-04-25 with reprex v2.0.2

@t-kalinowski
Copy link
Member

Closing for now since I can't reproduce the error.

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