bert模型demo
使用bert做分类任务
需要下载**BERT-Base, Chinese
**模型,放在根目录下
huwenxianglyy / bert-use-demo Goto Github PK
View Code? Open in Web Editor NEWthe demo for bert
the demo for bert
bert模型demo
使用bert做分类任务
需要下载**BERT-Base, Chinese
**模型,放在根目录下
如果可以,希望加下您联系方式,交流一下
qq:931626406
num_labels=20,实际上只有0,1,2,3 他们分别代表什么
你好楼主,在demo.py中,lost函数有一段代码:
# probabilities = tf.nn.softmax(logits, axis=-1)
log_probs = tf.nn.log_softmax(logits, axis=-1)
one_hot_labels = tf.one_hot(input_labels, depth=num_labels, dtype=tf.float32)
per_example_loss = -tf.reduce_sum(one_hot_labels * log_probs, axis=-1)
loss = tf.reduce_mean(per_example_loss)
predictions = tf.reshape(tf.argmax(logits, axis=-1, output_type=tf.int32),shape=[-1,1],name="predictions")
acc = tf.reduce_mean(tf.cast(tf.equal(input_labels, predictions), "float"),
name="accuracy")
跟踪代码:
log_probs 的shape=(20,20) 第一个20表示batch,第二个20表示标签
one_hot_labels 的shape=(20, 1 , 20) 第一个20表示batch,第2个20表示标签,这个1不太清楚?
one_hot_labels * log_probs 的shape=(20, 20 , 20)
per_example_loss 为什么这么计算?
希望楼主能回答,万分感谢!
请问一下,您这边使用的tensorflow的版本是什么样的,以及其他相关包的版本是什么样的,可以简单说明一下吗,谢谢
tensorflow.python.framework.errors_impl.NotFoundError: Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:
Key bert/embeddings/LayerNorm/beta/adam_m not found in checkpoint
[[node save/RestoreV2 (defined at C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\framework\ops.py:1748) ]]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.