当前位置:网站首页>Make word2vec for Bert model
Make word2vec for Bert model
2022-06-21 14:13:00 【Skinhead strength 12138】
BERT The model makes word2vec
One 、 Model download
BERT Model ,GitHub Source code , Download address
https://github.com/google-research/bert
bert Model
PS:Multilingual It's a multilingual model , The last one is the Chinese model ( Only word level ) among Uncased Is to convert all letters to lowercase , and Cased Case is reserved
Download the corresponding files according to your own needs and extract them
Two 、 Environment configuration
The runnable environment has been tested :
- python 3.6
- tensorflow 1.14.0
- tensorflow-gpu 1.14.0


Environment configuration
Minimalist configuration Tensorflow, No need to download separately CUDA,cuDNN
- Use Anaconda Create a python Version is 3.6 New virtual environment for
- Click on the right arrow ,open terminal

- The input terminal
conda install -c aaronzs tensorflow-gpu==xxx, You can also specify no version
Wait for download to complete - Enter... When finished
conda listIf there iscudatoolkitandcudnnIt means success - open pycharm, New projects , When creating a new project, select the environment just configured conda A virtual environment


- After the completion of the new project , Use terminal Enter the following command , install bert-service Support package
pip install bert-serving-client
pip install bert-serving-server
Be careful tensorflow And CUDA、python Version corresponding 
thus , All the required environments have been configured
PS: Environment configuration reference
TensorFlow-GPU The minimalist ——— No need to install cuda、cuDNN!!!
BERT First experience
3、 ... and 、Bert Simple application of model
start-up BertClient
terminal Input in
bert-serving-start -model_dir E:\Python-Project\uncased_L-12_H-768_A-12\uncased_L-12_H-768_A-12\ -num_worker=1
among ,model-dir Input the decompressed bert Model storage path , It's better to use absolute path , Not easy to make mistakes
start-up 
Only when at last “start the sink、ready、listen” The start-up is successful
It's only activated bert-serving service , Can be used bert Model
bert Simple model demo
obtain ‘dog’ The word of the vector ,1*768 dimension
from bert_serving.client import BertClient
import numpy as np
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
client = BertClient()
x = client.encode(['dog'])
print(np.shape(x))
print(x)

BUG Record
- bert The model can be started , But it got stuck in the middle , Never run to the end —— Not properly installed tensorflow、 perhaps tensorflow-gpu, In short, it is an environmental problem
- start-up graph Failure !—— May be tensorflow-gpu Version of the problem , At first I used 1.15 This error was published , Then downgrade to 1.14 No more error reporting after
- Inexplicably python Startup error !—— Maybe I thought it was on the computer python Too many versions are too messy , I rebuilt a project , Put the code copy In the past , Restart , normal !
边栏推荐
- What are the log files in MySQL?
- What fun things can a desk service do
- Atguigu---- conditional rendering
- Reptile Foundation_ urllib
- Write a code hot deployment
- 使用api制作我的足迹地图
- Azure applicationinsights integrated in blazor
- 3D slicer saves segmentation results
- Mr. Ali taught you how to use JMeter for pressure test (detailed drawing)
- Map collection traversal, adding, replacing and deleting elements
猜你喜欢

7hutool actual fileutil file tool class (common operation methods for more than 100 files)

The code remotely calls aria2 to download URL resources or BT seeds

Unbounded territory won the title of innovative brand of digital culture industry in 2022

Chapter 3 - data link layer

Dplayer development barrage background

Record the troubleshooting process of excessive CPU usage

MySQL - transaction management

Automation operation and maintenance 1 - installation and deployment of ansible

Chapter IX Cisco ASA application nat

C language elementary level (IX) enumeration
随机推荐
module ‘selenium. webdriver‘ has no attribute ‘PhantomJS‘
Detailed explanation of hashtable source code in C #
MySQL - table operation
1. memory partition model
给网站添加SSL安全证书
618 Nuggets digital collection? Burberry and other luxury brands fight against metauniverse
Pyqt5 learning notes of orange_ Basic structure of pyqt5 GUI program
Imitation B station web, app, background
C language elementary level (IX) enumeration
Prepare for the golden three silver four, are you ready? Summary of software test interview questions
How does JMeter implement interface association?
Installation of oracle19c under alicloud lightweight application server linux-centos7
Automatic operation and maintenance 3 - using playbook in ansible
2021 the latest selenium truly bypasses webdriver detection
MySQL - adding, deleting, querying and modifying tables
Write a compile time annotation
Explain the high availability features of Nacos
MySQL - table join and join
Quelle plate - forme à terme est plus sûre. Je vous en prie.
Making my footprint map using API