Giter Site home page Giter Site logo

Should we make a CI? about keras-io HOT 12 CLOSED

keras-team avatar keras-team commented on May 12, 2024
Should we make a CI?

from keras-io.

Comments (12)

fchollet avatar fchollet commented on May 12, 2024

Yes, I think adding CI is a great idea. There are two aspects here:

  • Adding tests for tutobook functionality and docs autogeneration functionality so that we can make changes to it with confidence.
  • Adding integration tests that run all guides and examples (possibly after some transformation to make them more lightweight, e.g. restricting all epochs= values to 1). This would work as a form of Keras regression test.

The 2nd one is probably too heavy for the free tier of commercial CI systems, it would have to be a manual setup on GCP. The 1st one could be setup quickly.

from keras-io.

gabrieldemarmiesse avatar gabrieldemarmiesse commented on May 12, 2024

I'm having trouble running the python autogen.py make, even though I have no issues with the dependencies.

$ python autogen.py make
Clearing ../sources/
...Processing .
...Processing about
...Processing getting_started
...Processing getting_started/intro_to_keras_for_engineers
...Processing getting_started/intro_to_keras_for_researchers
...Processing getting_started/ecosystem
...Processing getting_started/learning_resources
...Processing getting_started/faq
...Processing guides
...Processing guides/functional_api
...Processing guides/sequential_model
...Processing guides/making_new_layers_and_models_via_subclassing
...Processing guides/training_with_built_in_methods
...Processing guides/customizing_what_happens_in_fit
...Processing guides/writing_a_training_loop_from_scratch
...Processing guides/serialization_and_saving
...Processing guides/writing_your_own_callbacks
...Processing guides/working_with_rnns
...Processing guides/understanding_masking_and_padding
...Processing guides/distributed_training
...Processing guides/transfer_learning
...Processing api
...Processing api/models
2020-05-12 19:45:45.746578: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-05-12 19:45:45.746629: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
...Processing api/models/model
/opt/conda/lib/python3.7/site-packages/sphinx/util/inspect.py:555: RemovedInSphinx40Warning: sphinx.util.inspect.Signature() is deprecated
  RemovedInSphinx40Warning)
...Processing api/models/sequential
...Processing api/models/model_training_apis
...Processing api/models/model_saving_apis
...Processing api/layers
...Processing api/layers/base_layer
...Processing api/layers/activations
...Processing api/layers/initializers
...Processing api/layers/regularizers
...Processing api/layers/constraints
...Processing api/layers/core_layers
...Processing api/layers/core_layers/input
...Processing api/layers/core_layers/dense
...Processing api/layers/core_layers/activation
...Processing api/layers/core_layers/embedding
...Processing api/layers/core_layers/masking
...Processing api/layers/core_layers/lambda
...Processing api/layers/convolution_layers
...Processing api/layers/convolution_layers/convolution1d
...Processing api/layers/convolution_layers/convolution2d
...Processing api/layers/convolution_layers/convolution3d
...Processing api/layers/convolution_layers/separable_convolution1d
...Processing api/layers/convolution_layers/separable_convolution2d
...Processing api/layers/convolution_layers/depthwise_convolution2d
...Processing api/layers/convolution_layers/convolution2d_transpose
...Processing api/layers/convolution_layers/convolution3d_transpose
...Processing api/layers/pooling_layers
...Processing api/layers/pooling_layers/max_pooling1d
...Processing api/layers/pooling_layers/max_pooling2d
...Processing api/layers/pooling_layers/max_pooling3d
...Processing api/layers/pooling_layers/average_pooling1d
...Processing api/layers/pooling_layers/average_pooling2d
...Processing api/layers/pooling_layers/average_pooling3d
...Processing api/layers/pooling_layers/global_max_pooling1d
...Processing api/layers/pooling_layers/global_max_pooling2d
...Processing api/layers/pooling_layers/global_max_pooling3d
...Processing api/layers/pooling_layers/global_average_pooling1d
...Processing api/layers/pooling_layers/global_average_pooling2d
...Processing api/layers/pooling_layers/global_average_pooling3d
...Processing api/layers/recurrent_layers
...Processing api/layers/recurrent_layers/lstm
...Processing api/layers/recurrent_layers/gru
...Processing api/layers/recurrent_layers/simple_rnn
...Processing api/layers/recurrent_layers/time_distributed
...Processing api/layers/recurrent_layers/bidirectional
...Processing api/layers/recurrent_layers/conv_lstm2d
...Processing api/layers/preprocessing_layers
...Processing api/layers/preprocessing_layers/core_preprocessing_layers
...Processing api/layers/preprocessing_layers/core_preprocessing_layers/text_vectorization
...Processing api/layers/preprocessing_layers/core_preprocessing_layers/normalization
...Processing api/layers/normalization_layers
...Processing api/layers/normalization_layers/batch_normalization
...Processing api/layers/normalization_layers/layer_normalization
...Processing api/layers/regularization_layers
...Processing api/layers/regularization_layers/dropout
...Processing api/layers/regularization_layers/spatial_dropout1d
...Processing api/layers/regularization_layers/spatial_dropout2d
...Processing api/layers/regularization_layers/spatial_dropout3d
...Processing api/layers/regularization_layers/gaussian_dropout
...Processing api/layers/regularization_layers/gaussian_noise
...Processing api/layers/regularization_layers/activity_regularization
...Processing api/layers/regularization_layers/alpha_dropout
...Processing api/layers/attention_layers
...Processing api/layers/attention_layers/attention
...Processing api/layers/attention_layers/additive_attention
...Processing api/layers/reshaping_layers
...Processing api/layers/reshaping_layers/reshape
...Processing api/layers/reshaping_layers/flatten
...Processing api/layers/reshaping_layers/repeat_vector
...Processing api/layers/reshaping_layers/permute
...Processing api/layers/reshaping_layers/cropping1d
...Processing api/layers/reshaping_layers/cropping2d
...Processing api/layers/reshaping_layers/cropping3d
...Processing api/layers/reshaping_layers/up_sampling1d
...Processing api/layers/reshaping_layers/up_sampling2d
...Processing api/layers/reshaping_layers/up_sampling3d
...Processing api/layers/reshaping_layers/zero_padding1d
...Processing api/layers/reshaping_layers/zero_padding2d
...Processing api/layers/reshaping_layers/zero_padding3d
...Processing api/layers/merging_layers
...Processing api/layers/merging_layers/concatenate
...Processing api/layers/merging_layers/average
...Processing api/layers/merging_layers/maximum
...Processing api/layers/merging_layers/minimum
...Processing api/layers/merging_layers/add
...Processing api/layers/merging_layers/subtract
...Processing api/layers/merging_layers/multiply
...Processing api/layers/merging_layers/dot
...Processing api/layers/locally_connected_layers
...Processing api/layers/locally_connected_layers/locall_connected1d
...Processing api/layers/locally_connected_layers/locall_connected2d
...Processing api/layers/activation_layers
...Processing api/layers/activation_layers/relu
...Processing api/layers/activation_layers/softmax
...Processing api/layers/activation_layers/leaky_relu
...Processing api/layers/activation_layers/prelu
...Processing api/layers/activation_layers/elu
...Processing api/layers/activation_layers/threshold_relu
...Processing api/callbacks
...Processing api/callbacks/base_callback
...Processing api/callbacks/model_checkpoint
...Processing api/callbacks/tensorboard
...Processing api/callbacks/early_stopping
...Processing api/callbacks/learning_rate_scheduler
...Processing api/callbacks/reduce_lr_on_plateau
...Processing api/callbacks/remote_monitor
...Processing api/callbacks/lambda_callback
...Processing api/callbacks/terminate_on_nan
...Processing api/callbacks/csv_logger
...Processing api/callbacks/progbar_logger
...Processing api/preprocessing
...Processing api/preprocessing/image
...Processing api/preprocessing/timeseries
...Processing api/preprocessing/text
...Processing api/optimizers
...Processing api/optimizers/sgd
...Processing api/optimizers/rmsprop
...Processing api/optimizers/adam
...Processing api/optimizers/adadelta
...Processing api/optimizers/adagrad
...Processing api/optimizers/adamax
...Processing api/optimizers/Nadam
...Processing api/optimizers/ftrl
...Processing api/optimizers/learning_rate_schedules
...Processing api/optimizers/learning_rate_schedules/exponential_decay
...Processing api/optimizers/learning_rate_schedules/piecewise_constant_decay
...Processing api/optimizers/learning_rate_schedules/polynomial_decay
...Processing api/optimizers/learning_rate_schedules/inverse_time_decay
...Processing api/optimizers/learning_rate_schedules/exponential_decay
...Processing api/metrics
...Processing api/metrics/accuracy_metrics
...Processing api/metrics/probabilistic_metrics
...Processing api/metrics/regression_metrics
...Processing api/metrics/classification_metrics
...Processing api/metrics/segmentation_metrics
...Processing api/metrics/hinge_metrics
...Processing api/losses
...Processing api/losses/probabilistic_losses
...Processing api/losses/regression_losses
...Processing api/losses/hinge_losses
...Processing api/datasets
...Processing api/datasets/mnist
...Processing api/datasets/cifar10
...Processing api/datasets/cifar100
...Processing api/datasets/imdb
...Processing api/datasets/reuters
...Processing api/datasets/fashion_mnist
...Processing api/datasets/boston_housing
...Processing api/applications
...Processing api/applications/xception
...Processing api/applications/efficientnet
...Processing api/applications/vgg
...Processing api/applications/resnet
...Processing api/applications/mobilenet
...Processing api/applications/densenet
...Processing api/applications/nasnet
...Processing api/applications/inceptionv3
...Processing api/applications/inceptionresnetv2
...Processing api/utils
...Processing api/utils/model_plotting_utils
...Processing api/utils/serialization_utils
...Processing api/utils/python_utils
...Processing api/utils/backend_utils
...Processing examples
...Processing examples/vision
...Processing examples/vision/conv_lstm
...Processing examples/vision/oxford_pets_image_segmentation
...Processing examples/vision/image_classification_from_scratch
...Processing examples/vision/grad_cam
...Processing examples/vision/mnist_convnet
...Processing examples/nlp
...Processing examples/nlp/text_classification_with_transformer
...Processing examples/nlp/pretrained_word_embeddings
...Processing examples/nlp/addition_rnn
...Processing examples/nlp/lstm_seq2seq
...Processing examples/nlp/bidirectional_lstm_imdb
...Processing examples/nlp/text_classification_from_scratch
...Processing examples/structured_data
...Processing examples/structured_data/imbalanced_classification
...Processing examples/generative
...Processing examples/generative/wgan_gp
...Processing examples/generative/deep_dream
...Processing examples/generative/vae
...Processing examples/generative/lstm_character_level_text_generation
...Processing examples/generative/neural_style_transfer
...Processing examples/generative/dcgan_overriding_train_step
...Processing examples/keras_recipes
...Processing examples/keras_recipes/antirectifier
...Processing examples/keras_recipes/endpoint_layer_pattern
...Processing examples/keras_recipes/quasi_svm
...Processing why_keras
...Processing governance
...Processing contributing
Clearing ../site/
Rendering ../site/why_keras.md
Writing ../site/why_keras/index.html
Rendering ../site/contributing.md
Writing ../site/contributing/index.html
Rendering ../site/governance.md
Writing ../site/governance/index.html
Rendering ../site/about.md
Writing ../site/about/index.html
Rendering ../site/index.md
Writing ../site/index.html
Rendering ../site/getting_started/intro_to_keras_for_researchers.md
Writing ../site/getting_started/intro_to_keras_for_researchers/index.html
Rendering ../site/getting_started/ecosystem.md
Writing ../site/getting_started/ecosystem/index.html
Rendering ../site/getting_started/learning_resources.md
Writing ../site/getting_started/learning_resources/index.html
Rendering ../site/getting_started/faq.md
Writing ../site/getting_started/faq/index.html
Rendering ../site/getting_started/intro_to_keras_for_engineers.md
Writing ../site/getting_started/intro_to_keras_for_engineers/index.html
Rendering ../site/getting_started/index.md
Writing ../site/getting_started/index.html
Rendering ../site/examples/index.md
Writing ../site/examples/index.html
Rendering ../site/examples/vision/oxford_pets_image_segmentation.md
Writing ../site/examples/vision/oxford_pets_image_segmentation/index.html
Rendering ../site/examples/vision/image_classification_from_scratch.md
Writing ../site/examples/vision/image_classification_from_scratch/index.html
Rendering ../site/examples/vision/conv_lstm.md
Writing ../site/examples/vision/conv_lstm/index.html
Rendering ../site/examples/vision/grad_cam.md
Writing ../site/examples/vision/grad_cam/index.html
Rendering ../site/examples/vision/index.md
Writing ../site/examples/vision/index.html
Rendering ../site/examples/vision/mnist_convnet.md
Writing ../site/examples/vision/mnist_convnet/index.html
Rendering ../site/examples/structured_data/imbalanced_classification.md
Writing ../site/examples/structured_data/imbalanced_classification/index.html
Rendering ../site/examples/structured_data/index.md
Writing ../site/examples/structured_data/index.html
Rendering ../site/examples/keras_recipes/quasi_svm.md
Writing ../site/examples/keras_recipes/quasi_svm/index.html
Rendering ../site/examples/keras_recipes/endpoint_layer_pattern.md
Writing ../site/examples/keras_recipes/endpoint_layer_pattern/index.html
Rendering ../site/examples/keras_recipes/antirectifier.md
Writing ../site/examples/keras_recipes/antirectifier/index.html
Rendering ../site/examples/keras_recipes/index.md
Writing ../site/examples/keras_recipes/index.html
Rendering ../site/examples/generative/lstm_character_level_text_generation.md
Writing ../site/examples/generative/lstm_character_level_text_generation/index.html
Rendering ../site/examples/generative/vae.md
Writing ../site/examples/generative/vae/index.html
Rendering ../site/examples/generative/neural_style_transfer.md
Writing ../site/examples/generative/neural_style_transfer/index.html
Rendering ../site/examples/generative/dcgan_overriding_train_step.md
Writing ../site/examples/generative/dcgan_overriding_train_step/index.html
Rendering ../site/examples/generative/wgan_gp.md
Writing ../site/examples/generative/wgan_gp/index.html
Rendering ../site/examples/generative/index.md
Writing ../site/examples/generative/index.html
Rendering ../site/examples/generative/deep_dream.md
Writing ../site/examples/generative/deep_dream/index.html
Rendering ../site/examples/nlp/text_classification_with_transformer.md
Writing ../site/examples/nlp/text_classification_with_transformer/index.html
Rendering ../site/examples/nlp/text_classification_from_scratch.md
Writing ../site/examples/nlp/text_classification_from_scratch/index.html
Rendering ../site/examples/nlp/lstm_seq2seq.md
Writing ../site/examples/nlp/lstm_seq2seq/index.html
Rendering ../site/examples/nlp/pretrained_word_embeddings.md
Writing ../site/examples/nlp/pretrained_word_embeddings/index.html
Rendering ../site/examples/nlp/addition_rnn.md
Writing ../site/examples/nlp/addition_rnn/index.html
Rendering ../site/examples/nlp/index.md
Writing ../site/examples/nlp/index.html
Rendering ../site/examples/nlp/bidirectional_lstm_imdb.md
Writing ../site/examples/nlp/bidirectional_lstm_imdb/index.html
Rendering ../site/guides/functional_api.md
Writing ../site/guides/functional_api/index.html
Rendering ../site/guides/distributed_training.md
Writing ../site/guides/distributed_training/index.html
Rendering ../site/guides/making_new_layers_and_models_via_subclassing.md
Writing ../site/guides/making_new_layers_and_models_via_subclassing/index.html
Rendering ../site/guides/customizing_what_happens_in_fit.md
Writing ../site/guides/customizing_what_happens_in_fit/index.html
Rendering ../site/guides/transfer_learning.md
Writing ../site/guides/transfer_learning/index.html
Rendering ../site/guides/training_with_built_in_methods.md
Writing ../site/guides/training_with_built_in_methods/index.html
Rendering ../site/guides/working_with_rnns.md
Writing ../site/guides/working_with_rnns/index.html
Rendering ../site/guides/writing_a_training_loop_from_scratch.md
Writing ../site/guides/writing_a_training_loop_from_scratch/index.html
Rendering ../site/guides/serialization_and_saving.md
Writing ../site/guides/serialization_and_saving/index.html
Rendering ../site/guides/sequential_model.md
Writing ../site/guides/sequential_model/index.html
Rendering ../site/guides/index.md
Writing ../site/guides/index.html
Rendering ../site/guides/understanding_masking_and_padding.md
Writing ../site/guides/understanding_masking_and_padding/index.html
Rendering ../site/guides/writing_your_own_callbacks.md
Writing ../site/guides/writing_your_own_callbacks/index.html
Rendering ../site/api/index.md
Writing ../site/api/index.html
Rendering ../site/api/preprocessing/image.md
Writing ../site/api/preprocessing/image/index.html
Rendering ../site/api/preprocessing/text.md
Writing ../site/api/preprocessing/text/index.html
Rendering ../site/api/preprocessing/timeseries.md
Writing ../site/api/preprocessing/timeseries/index.html
Rendering ../site/api/preprocessing/index.md
Writing ../site/api/preprocessing/index.html
Rendering ../site/api/datasets/imdb.md
Writing ../site/api/datasets/imdb/index.html
Rendering ../site/api/datasets/reuters.md
Writing ../site/api/datasets/reuters/index.html
Rendering ../site/api/datasets/fashion_mnist.md
Writing ../site/api/datasets/fashion_mnist/index.html
Rendering ../site/api/datasets/cifar100.md
Writing ../site/api/datasets/cifar100/index.html
Rendering ../site/api/datasets/cifar10.md
Writing ../site/api/datasets/cifar10/index.html
Rendering ../site/api/datasets/mnist.md
Writing ../site/api/datasets/mnist/index.html
Rendering ../site/api/datasets/index.md
Writing ../site/api/datasets/index.html
Rendering ../site/api/datasets/boston_housing.md
Writing ../site/api/datasets/boston_housing/index.html
Rendering ../site/api/applications/densenet.md
Writing ../site/api/applications/densenet/index.html
Rendering ../site/api/applications/nasnet.md
Writing ../site/api/applications/nasnet/index.html
Rendering ../site/api/applications/inceptionv3.md
Writing ../site/api/applications/inceptionv3/index.html
Rendering ../site/api/applications/xception.md
Writing ../site/api/applications/xception/index.html
Rendering ../site/api/applications/inceptionresnetv2.md
Writing ../site/api/applications/inceptionresnetv2/index.html
Rendering ../site/api/applications/index.md
Writing ../site/api/applications/index.html
Rendering ../site/api/applications/resnet.md
Writing ../site/api/applications/resnet/index.html
Rendering ../site/api/applications/vgg.md
Writing ../site/api/applications/vgg/index.html
Rendering ../site/api/applications/efficientnet.md
Writing ../site/api/applications/efficientnet/index.html
Rendering ../site/api/applications/mobilenet.md
Writing ../site/api/applications/mobilenet/index.html
Rendering ../site/api/layers/activations.md
Writing ../site/api/layers/activations/index.html
Rendering ../site/api/layers/regularizers.md
Writing ../site/api/layers/regularizers/index.html
Rendering ../site/api/layers/constraints.md
Writing ../site/api/layers/constraints/index.html
Rendering ../site/api/layers/base_layer.md
<h1 id="the-base-layer-class">The base Layer class</h1>
<h3 id="layer-class"><code>Layer</code> class</h3>
<div class="codehilite"><pre><span></span><code><span class="n">tf</span><span class="o">.</span><span class="n">keras</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">Layer</span><span class="p">(</span>
    <span class="n">trainable</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dynamic</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span>
<span class="p">)</span>
</code></pre></div>


<p>This is the class from which all layers inherit.</p>
<p>A layer is a callable object that takes as input one or more tensors and
that outputs one or more tensors. It involves <em>computation</em>, defined
in the <code>call()</code> method, and a <em>state</em> (weight variables), defined
either in the constructor <code>__init__()</code> or in the <code>build()</code> method.</p>
<p>Users will just instantiate a layer and then treat it as a callable.</p>
...

#############   Some more HTML here, cutting because it's too long

...
<span class="err">&gt;&gt;&gt; d = tf.keras.layers.Dense(2)</span>
<span class="err">&gt;&gt;&gt; output = d(input)</span>
<span class="err">&gt;&gt;&gt; d.add_metric(tf.reduce_max(output), name=&#39;max&#39;)</span>
<span class="err">&gt;&gt;&gt; d.add_metric(tf.reduce_min(output), name=&#39;min&#39;)</span>
<span class="err">&gt;&gt;&gt; [m.name for m in d.metrics]</span>
<span class="err">[&#39;max&#39;, &#39;min&#39;]</span>
</code></pre></div>


<p></code></p>
<p><strong>Returns</strong></p>
<p>A list of tensors.</p>
<hr />
<h3 id="dynamic-property"><code>dynamic</code> property</h3>
<div class="codehilite"><pre><span></span><code><span class="n">tf</span><span class="o">.</span><span class="n">keras</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">Layer</span><span class="o">.</span><span class="n">dynamic</span>
</code></pre></div>


<p>Whether the layer is dynamic (eager-only); set in the constructor.</p>
<hr />
Traceback (most recent call last):
  File "autogen.py", line 896, in <module>
    keras_io.render_md_sources_to_html()
  File "autogen.py", line 564, in render_md_sources_to_html
    html_content = post_process_code_blocks(html_content)
  File "autogen.py", line 704, in post_process_code_blocks
    raise ValueError("Comment tags left over in HTML")
ValueError: Comment tags left over in HTML

I'm using the latest master commit.

@fchollet does that ring any bells? I'll continue to investigate in the meantime.

from keras-io.

fchollet avatar fchollet commented on May 12, 2024

This seems pretty weird. This error is critical; the files should never be uploaded if there are tags left. I'm currently able to generate the docs without any issue and I haven't investigated this problem, so not sure what's going on.

from keras-io.

fchollet avatar fchollet commented on May 12, 2024

Can you copy the parts of the HTML that feature the comment tags?

from keras-io.

gabrieldemarmiesse avatar gabrieldemarmiesse commented on May 12, 2024

Yes, here is the part that has an issue, when converting base_layer.md:

<p></code></p>
<p><code class="k-shell"></p>
<div class="codehilite"><pre><span></span><code><span class="err">&gt;&gt;&gt; inputs = tf.keras.Input(shape=(10,))</span>
<span class="err">&gt;&gt;&gt; x = tf.keras.layers.Dense(10)(inputs)</span>
<span class="err">&gt;&gt;&gt; outputs = tf.keras.layers.Dense(1)(x)</span>
<span class="err">&gt;&gt;&gt; model = tf.keras.Model(inputs, outputs)</span>
<span class="err">&gt;&gt;&gt;KCOMMENT_START # Activity regularization. </span> </span>
<span class="err">&gt;&gt;&gt; model.add_loss(tf.abs(tf.reduce_mean(x)))</span>
<span class="err">&gt;&gt;&gt; model.losses</span>
<span class="err">[&lt;tf.Tensor &#39;Abs:0&#39; shape=() dtype=float32&gt;]</span>
</code></pre></div>


<p></code></p>
<p><code class="k-shell"></p>
<div class="codehilite"><pre><span></span><code><span class="err">&gt;&gt;&gt; inputs = tf.keras.Input(shape=(10,))</span>
<span class="err">&gt;&gt;&gt; d = tf.keras.layers.Dense(10, kernel_initializer=&#39;ones&#39;)</span>
<span class="err">&gt;&gt;&gt; x = d(inputs)</span>
<span class="err">&gt;&gt;&gt; outputs = tf.keras.layers.Dense(1)(x)</span>
<span class="err">&gt;&gt;&gt; model = tf.keras.Model(inputs, outputs)</span>
<span class="err">&gt;&gt;&gt;KCOMMENT_START # Weight regularization. </span> </span>
<span class="err">&gt;&gt;&gt; model.add_loss(lambda: tf.reduce_mean(d.kernel))</span>
<span class="err">&gt;&gt;&gt; model.losses</span>
<span class="err">[&lt;tf.Tensor: shape=(), dtype=float32, numpy=1.0&gt;]</span>
</code></pre></div>

If I force the generation of the website, this is displayed for the first code block:

>>> inputs = tf.keras.Input(shape=(10,))
>>> x = tf.keras.layers.Dense(10)(inputs)
>>> outputs = tf.keras.layers.Dense(1)(x)
>>> model = tf.keras.Model(inputs, outputs)
>>>KCOMMENT_START # Activity regularization.  
>>> model.add_loss(tf.abs(tf.reduce_mean(x)))
>>> model.losses
[<tf.Tensor 'Abs:0' shape=() dtype=float32>]

One would expect to see this instead: https://keras.io/api/layers/base_layer/#losses-property

If I extract the markdown in the generation script, just before the conversion to html:

<code class="k-shell">
```
>>> inputs = tf.keras.Input(shape=(10,))
>>> x = tf.keras.layers.Dense(10)(inputs)
>>> outputs = tf.keras.layers.Dense(1)(x)
>>> model = tf.keras.Model(inputs, outputs)
>>>KCOMMENT_START # Activity regularization. KCOMMENT_END
>>> model.add_loss(tf.abs(tf.reduce_mean(x)))
>>> model.losses
[<tf.Tensor 'Abs:0' shape=() dtype=float32>]
```
</code>

If we comment out the raise ValueError(...) we can see this problem happening with more files in the website. Those are:

base_layer.md
initializers.md
convolution1d.md
convolution3d.md
add.md
reshape.md
probabilistic_metrics.md
segmentation_metrics.md
regression_metrics.md
classification_metrics.md
backend_utils.md
sequential.md
probabilistic_losses.md
hinge_losses.md
regression_losses.md
learning_rate_scheduler.md

This error seems reproducible, as seen in the proposed CI: https://github.com/keras-team/keras-io/pull/27/checks?check_run_id=669700161 the full log is displayed there.

If one wants to reproduce the bug locally, what's needed is to checkout the pull request #27 locally and do docker build ..

Do you think there might be small differences between your local setup and the version on github?

I'll try to find out more in the meantime and edit this message if there are any news.

from keras-io.

fchollet avatar fchollet commented on May 12, 2024

We should debug why the tag doesn't get removed in your case.

If that helps, here's my setup:

Python 3.7.4
>>> import pygments
>>> pygments.__version__
'2.4.2'
>>> import markdown
>>> markdown.__version__
'3.2.1'

I don't think other libraries are suspect here.

from keras-io.

gabrieldemarmiesse avatar gabrieldemarmiesse commented on May 12, 2024

Thanks a lot! After some experiments, pygments was the culprit. The CI used the 2.6.1 version. I tried with the 2.5.x, but it doesn't work either. 2.4.2 is the highest we can go for the moment without breaking the html generation. I updated the requirements.txt in my pull request accordingly.

from keras-io.

irvifa avatar irvifa commented on May 12, 2024

I suppose we can close this then? It's solved already on #27 isn't?

from keras-io.

gabrieldemarmiesse avatar gabrieldemarmiesse commented on May 12, 2024

Ideally we should run the python scripts too to verify that they work

from keras-io.

RobAltena avatar RobAltena commented on May 12, 2024

I just bumped into this. Maybe it helps reproducing and fixing:
python autogen.py make runs fine after a clean install (Win10, fresh conda environment with Python 3.7, and pip install -r requirements.txt. To work on an example I had to install pandas which upgraded numpy, which breaks pygments. now python autogen.py make gives the error.

pip install -r requirements.txt then uninstalls numpy 1.19.1 and Pygments 2.6.1. installs numpy 1.18.5 and pygments 2.4.2. python autogen.py make runs fine again.

from keras-io.

irvifa avatar irvifa commented on May 12, 2024

Seems like dependencies issues. Would it be helpful if we specify the pigments and numpy in requirements.txt or using docker to generate the docs. So the dependencies will be in place.

from keras-io.

sachinprasadhs avatar sachinprasadhs commented on May 12, 2024

@gabrieldemarmiesse , If your issue is resolved, could you please spare some time to close this issue.
If it is not resolved, please test it in the latest Keras version. Thanks!

from keras-io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.