question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

kwargs not supported

See original GitHub issue

This issue occurs for all models in the repo but i’ll explain it in case of Unet If you try to pass any additional arguments to Unet model, they get into **kwargs and are passed to keras_applications.get_submodules_from_kwargs function https://github.com/qubvel/segmentation_models/blob/6fecc720be66d8b2bfb2b70105ee6fa5c99826d6/segmentation_models/models/unet.py#L211 which DOESN’T allow any extra arguments! and raises TypeError https://github.com/keras-team/keras-applications/blob/71acdcd98088501247f4b514b7cbbdf8182a05a4/keras_applications/__init__.py#L13-L21 it makes the following line useless: https://github.com/qubvel/segmentation_models/blob/6fecc720be66d8b2bfb2b70105ee6fa5c99826d6/segmentation_models/models/unet.py#L226

I think the easiest way to fix this issue is to write a custom get_submodules_from_kwargs function. I can make PR if you find it helpfull

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
qubvelcommented, Oct 22, 2019

@JonnoFTW Do not import Unet from .models, look at example in readme

1reaction
JonnoFTWcommented, Oct 21, 2019

I’m using the latest code from github and get an error later on about backend being NoneType. I got it working with:

from keras import layers, utils, models
from segmentation_models.models import unet
model = unet.Unet('efficientnetb3', classes=num_classes, activation='softmax',
                     backend=K, layers=layers, utils=utils, models=models)
Read more comments on GitHub >

github_iconTop Results From Across the Web

args and **kwargs not supported · Issue #147 - GitHub
My use case is a rather generic decorator applied to some endpoints. It shouldn't matter how these endpoints are called, but they must...
Read more >
kwargs not passing variables to function, what's wrong?
For some reason, I can't get the variables passed in **kwargs in Python to be seen by the receiving function. (RESOLVED - see...
Read more >
Supporting (or not) invalid identifiers in **kwargs - Ideas
The dict reads a scope, it does not create one (or at least it's not documented as such). But in the case of...
Read more >
Python args and kwargs: Demystified
In this step-by-step tutorial, you'll learn how to use args and kwargs in Python to add more flexibility to your functions. You'll also...
Read more >
How To Use *args and **kwargs in Python 3 - DigitalOcean
In this tutorial, we will cover the syntax of working with *args and ... as the word kwargs is conventionally used, though not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found