Comments (5)
Sorry I should have said, the code runs fine, it just can't be interpreted by a static type checker. Our users are confused by this because they can execute their code just fine, but Pylance doesn't think there's a module called keras.models
. This makes it harder for them to write code using keras.models
because there's no intellisense for it anymore.
from keras.
@mattdangerw @sampathweb can we resolve this?
from keras.
The code added in this commit dynamically adds the path to api to the sys path. This isn't something a static type checker can handle.
Basically, publicly-exported APIs are in keras/api/
, rather than in the top-level keras/
folder. This is not unlike, e.g. TF APIs, which live in tf._api.v2
. Can PyLance only handle packages where the directory structure matches the public namespace?
from keras.
Can PyLance only handle packages where the directory structure matches the public namespace?
We should be able to handle anything that's through static imports. The old code was importing all of the api modules, so Pylance could tell that those were imported in the __init__.py
.
The code in the commit I referenced changed to add the api path to the sys.path at runtime. We don't execute any python code, so we can't actually figure out that api should be on the sys.path.
It's kind of similar to how we don't support PEP 660 because we can't execute the dynamic code in the .pth
files.
Here's a similar example:
microsoft/pyright#6272
from keras.
We also have a problem with tensorflow too when it imports keras like this:
from tensorflow.keras import activations, initializers, layers, losses, metrics, models, optimizers, regularizers
This is because keras is added to the tensorflow package dynamically.
from keras.
Related Issues (20)
- Unexpected depreciation warning in tensorflow 2.16.1 HOT 4
- Model attribute stop_evaluating does not work HOT 2
- While retraining a model I get worse values for MSE from the last epoch of last trainment to the first of the next HOT 2
- model.compile(jit_compile=True) for PyTorch has no intended effect (Keras 3.3) HOT 4
- `inputs` argument cannot be empty HOT 2
- Merge layers do not pass masks to the `compute_mask` function HOT 5
- Error in masked BatchNormalization with > 3 dimensions HOT 11
- activity_regularizer is omitted from get_config/serialization HOT 3
- `keras.ops.repeat` cannot return an exptected shape when `x` is a `KerasTensor` and the `axis` is `None` HOT 3
- sparse_categorical_crossentropy with ignore_class fails for 4D inputs HOT 2
- Keras 3.0 load h5 model with Orthogonal initializer fails HOT 7
- Type Error in keras.utils.get_file() HOT 1
- Custom objects support when pickling keras models HOT 3
- `PyDataset` of exactly correct size breaks when used in conjunction with exactly correct `validation_steps` HOT 1
- request: type information for layers HOT 4
- What are the migration replacements for this operations? HOT 2
- Keras in Google Colab and in Rstudio Python Script HOT 4
- Keras.ops.slice documentation error
- Autocompletion/hints fail for keras.Variables HOT 4
- BatchNormalization gives incorrect output with masked inputs > 3 dimensions HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras.