We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我想通过 albert_chinese_tiny 对一句话进行特征提取,再用提取的向量做我自己的训练。 由于 albert_chinese_tiny 的输出是 (none, 512, 21148),因此我对其进行了 max pooling,输出为 (none, 512)。 想请教这样的实践是否正确
albert_chinese_tiny
(none, 512, 21148)
(none, 512)
if __name__ == '__main__': import keras_albert_model import keras_bert import numpy as np from tensorflow import keras model = keras_albert_model.load_brightmart_albert_zh_checkpoint('./albert_tiny_489k/') tokenizer = keras_bert.Tokenizer(keras_bert.load_vocabulary('./albert_tiny_489k/vocab.txt')) outputs = keras.layers.GlobalMaxPool1D(name='MaxPooling', data_format='channels_first')(model.outputs[0]) model = keras.models.Model(inputs=model.inputs, outputs=outputs) model.summary() token, segment = tokenizer.encode('I like it', max_len=512) prediction = model.predict([np.array([token]), np.array([segment])])[0] print(prediction, prediction.shape)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我想通过
albert_chinese_tiny
对一句话进行特征提取,再用提取的向量做我自己的训练。由于
albert_chinese_tiny
的输出是(none, 512, 21148)
,因此我对其进行了 max pooling,输出为(none, 512)
。想请教这样的实践是否正确
The text was updated successfully, but these errors were encountered: