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.

I was wondering if it is possible to use this library to build a model, which can have multiple inputs.


inputs1 = ...
inputs2 = ...
inputs1_embedded = bert_embedding()(inputs1)
inputs2_embedded = bert_embedding()(inputs2)
model_out1 = model()(inputs1_embedded)
model_out2 = model()(inputs2_embedded)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

CyberZHGcommented, Jun 19, 2019

For the training parameter in load_trained_model_from_checkpoint function, does it simply means no masked language layer after encoders output if I set the parameter to True ?

No masked language layer if it is False.

When I was reading your Chinese README, it says “如果不想再训练嵌入层,可以传入trainable=['Encoder']来只对编码层进行调整”. Does this means if set trainable to [encoder] I am not fine tuning the bert’s embedding layers?


CyberZHGcommented, Jun 18, 2019

Model is callable just like Layers:

import os
import keras
from keras_bert import load_trained_model_from_checkpoint

inputs_1 = [
    keras.layers.Input(shape=(16,), name='Input-Token-1'),
    keras.layers.Input(shape=(16,), name='Input-Segment-1'),
inputs_2 = [
    keras.layers.Input(shape=(16,), name='Input-Token-2'),
    keras.layers.Input(shape=(16,), name='Input-Segment-2'),

current_path = os.path.dirname(os.path.abspath(__file__))
config_path = os.path.join(current_path, 'test_checkpoint', 'config.json')
model_path = os.path.join(current_path, 'test_checkpoint', 'model.ckpt-20')
model = load_trained_model_from_checkpoint(

outputs_1 = model(inputs_1)
outputs_2 = model(inputs_2)
model = keras.models.Model(inputs=inputs_1 + inputs_2, outputs=[outputs_1, outputs_2])
Read more comments on GitHub >

github_iconTop Results From Across the Web

Taking multiple inputs from user in Python - GeeksforGeeks
Using split() method : This function helps in getting multiple inputs from users. It breaks the given input by the specified separator. If...
Read more >
How to Take Multiple Inputs From Users In ... - In Plain English
This function helps in getting multiple inputs from users. It breaks the given input by the specified separator.
Read more >
How to take Multiple Input from User in Python - Javatpoint
# Taking multiple inputs in a single line · # and type casting using list() function · x = list(map(int, input("Enter multiple values:...
Read more >
Multiple inputs definition and meaning - Collins Dictionary
Multiple inputs definition: Input consists of information or resources that a group or project receives. [...] | Meaning, pronunciation, translations and ...
Read more >
Using multiple inputs - IBM
If you want your stage to handle multiple inputs, there are some special considerations. Your code needs to ensure the following:.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found