tf.keras and tfp.tfp.layers. are not compatible
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- jupyter-notebook
- Ambito
- machine-learning
Direzione di ricerca
Inizia riproducendo l'esempio di notebook fornito che aggiunge tfp.layers.VariationalGaussianProcess a un modello tf.keras.Sequential, incluso il ValueError mostrato. Verifica la compatibilità tra il layer e Keras; il lavoro è completato quando l'esempio riesce a costruire il modello senza l'errore di incompatibilità.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
hello fellow developers, it appears that the tf.keras and tfp.tfp.layers. are not compatible
i have this code="
**num_inducing_points = 40
model = tf.keras.Sequential([
tf.keras.layers.InputLayer(input_shape=[1], dtype=x.dtype),
tf.keras.layers.Dense(1, kernel_initializer='ones', use_bias=False),
tfp.layers.VariationalGaussianProcess(
num_inducing_points=num_inducing_points,
kernel_provider=RBFKernelFn(dtype=x.dtype),
event_shape=[1],
inducing_index_points_initializer=tf.constant_initializer(
np.linspace(*x_range, num=num_inducing_points,
dtype=x.dtype)[..., np.newaxis]),
unconstrained_observation_noise_variance_initializer=(
tf.constant_initializer(
np.log(np.expm1(1.)).astype(x.dtype))),
),
])
//Do inference.
batch_size = 32
loss = lambda y, rv_y: rv_y.variational_loss(
y, kl_weight=np.array(batch_size, x.dtype) / x.shape[0])
model.compile(optimizer=tf.optimizers.Adam(learning_rate=0.01), loss=loss)
model.fit(x, y, batch_size=batch_size, epochs=1000, verbose=False)
//Make predictions.
yhats = [model(x_tst) for _ in range(100)]**
"
and i get the following
error output=
"**:7: UserWarning: layer.add_variable is deprecated and will be removed in a future version. Please use the layer.add_weight() method instead.
self._amplitude = self.add_variable(
:12: UserWarning: layer.add_variable is deprecated and will be removed in a future version. Please use the layer.add_weight() method instead.
self._length_scale = self.add_variable(
ValueError Traceback (most recent call last)
in <cell line: 2>()
1 num_inducing_points = 40
----> 2 model = tf.keras.Sequential([
3 tf.keras.layers.InputLayer(input_shape=[1], dtype=x.dtype),
4 tf.keras.layers.Dense(1, kernel_initializer='ones', use_bias=False),
5 tfp.layers.VariationalGaussianProcess(
1 frames
/usr/local/lib/python3.10/dist-packages/keras/src/models/sequential.py in add(self, layer, rebuild)
93 layer = origin_layer
94 if not isinstance(layer, Layer):
---> 95 raise ValueError(
96 "Only instances of keras.Layer can be "
97 f"added to a Sequential model. Received: {layer} "
ValueError: Only instances of keras.Layer can be added to a Sequential model. Received: <tensorflow_probability.python.layers.distribution_layer.VariationalGaussianProcess object at 0x7acd5e77fc70> (of type <class 'tensorflow_probability.python.layers.distribution_layer.VariationalGaussianProcess'>)**"
- Lingua principale
- Jupyter Notebook
- Stelle
- 4.4k
- Fork
- 1.1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tensorflow/probability
-
KL divergence between two `TransformedDistribution`s with a shared non-injective bijector (`AbsoluteValue`) returns the base KLForse già presa @Andreas-Hum l’ha presa 7 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
tensorflow/probability#2036 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
tensorflow/probability#2034 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
tensorflow/probability#2021 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
tensorflow/probability#2015 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
tensorflow/probability#2013 ·
Tutte le issue di tensorflow/probability
Issue simili
-
[Bug]: DoubleMLRDDData accepts a score_col that is no data column (as in its docstring example); the running variable then becomes a covariate and RDFlex failsForse già presa @vrjdev l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
DoubleML/doubleml-for-py#455 ·
I maintainer di solito rispondono entro 1 giorno
-
Install page: spectarf's CUDA engine fails with PyTorch for CUDA 13.0 (nvvmError: ERROR_INVALID_IR)Forse già presa @lukepolson l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
PyTomography/PyTomography#435 ·
I maintainer di solito rispondono entro 1 giorno
-
beginner friendly
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
aws-samples/sample-per-model-bedrock#821 ·
I maintainer di solito rispondono entro 1 giorno
-
Strain created without dtype promotes the conservative+stress path to float64 under jax_enable_x64Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100