TensorFlow-Keras框架的深度学习模块和功能的集合

网友投稿 556 2022-10-31

TensorFlow-Keras框架的深度学习模块和功能的集合

TensorFlow-Keras框架的深度学习模块和功能的集合

Tavolo

tavolo aims to package together valuable modules and functionality written for TensorFlow high-level Keras API for ease of use. You see, the deep learning world is moving fast, and new ideas keep on coming. tavolo gathers implementations of these useful ideas from the community (by contribution, from Kaggle etc.) and makes them accessible in a single PyPI hosted package that compliments the tf.keras module.

Documentation

Tavolo documentation

Showcase

tavolo's API is straightforward and adopting its modules is as easy as it gets. In tavolo, you'll find implementations for basic layers like PositionalEncoding to complex modules like the Transformer's MultiHeadedAttention. You'll also find non-layer implementations that can ease development, like the LearningRateFinder. For example, if we wanted to add head a Yang-style attention mechanism into our model and look for the optimal learning rate, it would look something like:

import tensorflow as tfimport tavolo as tvlmodel = tf.keras.Sequential([ tf.keras.layers.Embedding(input_dim=vocab_size, output_dim=embedding_size, input_length=max_len), tvl.seq2vec.YangAttention(n_units=64), # <--- Add Yang style attention tf.keras.layers.Dense(n_hidden_units, activation='relu'), tf.keras.layers.Dense(1, activation='sigmoid')])model.compile(optimizer=tf.keras.optimizers.SGD(), loss=tf.keras.losses.BinaryCrossentropy())# Run learning rate range testlr_finder = tvl.learning.LearningRateFinder(model=model)learning_rates, losses = lr_finder.scan(train_data, train_labels, min_lr=0.0001, max_lr=1.0, batch_size=128)### Plot the results to choose your learning rate

Contributing

Want to contribute? Please read our Contributing guide.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:#yyds干货盘点# 解决名企真题:附加题
下一篇:Springboot 如何设置启动内存
相关文章

 发表评论

暂时没有评论,来抢沙发吧~