自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

明顯有閒

要獲得相當地位,就得獲得相當財產。

  • 博客(133)
  • 资源 (1)
  • 收藏
  • 关注

原创 mac系统完全删除mysql

mac系统完全删除mysqlmysql默认安装位置为/usr/local,删除相关文件打开终端:(base) ➜ ~ cd /usr/local/(base) ➜ local lsCellar mysqlHomebrew mysql-8.0.24-macos11-x86_64bin optetc remotedeskt

2021-05-07 23:38:53 427 1

原创 启动docker服务windows

# Docker Service on Windows can be started by using the following command:Start-Service docker# Docker Service can be stopped by running the following command:Stop-Service docker

2021-01-06 18:14:35 1405

原创 dockerfile build时报错

报错:有 Dockerfile 文件如下:(该文件可在vs code中使用插件生成,非常方便)# For more information, please refer to https://aka.ms/vscode-docker-pythonFROM python:3.8-slim-busterEXPOSE 5000# Keeps Python from generating .pyc files in the containerENV PYTHONDONTWRITEBYTECODE=1

2021-01-05 20:14:06 619

原创 docker login

登录docker仓库docker login -u username -p password hub.ifchange.com向仓库推送镜像docker push hub.ifchange.com/nlp/project_recognize_server:v2.2退出当前的登录docker logout hub.ifchange.com

2020-07-30 10:49:09 440

原创 tf serving 部署模型

建立networkdocker network create --driver bridge bridge_gyn# 相关查询命令docker network lsdocker network inspect bridge_gyndocker network rm bridge_gyntip: 将模型的容器和network连接docker network connect bridge_gyn my_containerdocker network inspect bridge_gynd.

2020-07-30 09:59:41 268

原创 zip命令压缩文件

zip命令压缩文件:zip -r folder.zip folder查看文件夹大小:du -sh *du -bsh *

2020-07-29 17:49:33 323

原创 python文件引入问题

有以下目录结构:- cat1 - cat2 - sub.py- main.py sub.py:print('sub')main.py:from cat1.cat2 import subprint('main')则可以直接在cat1平级目录下运行main:> python main.pysubmain但是如果目录结构如下:- cat1 - cat2 - sub.py - main.py 则需要添加两行sys相关代码,才能在cat1平级目录运行m

2020-07-16 19:12:02 173

原创 vscode连接远程服务出错

周一上班连接远程服务怎么都连接不上,明明上周五还是好用的。step1: 检查各项配置文件,都未改动step2: 网上搜索一番,挑选一种方案,正好work:1)登录远程服务器,删除.vscode-server文件夹:rm -rf .vscode-server(查看隐藏文件的命令ll -a)2)再连接远程服务器,成功...

2020-07-06 16:21:04 3763

原创 python切分句子

import redef remove_space(text): """ 去除空格 """ text = text.replace(' ', '') return textdef sentence_split(text): """ 将一个段落分成若干句子,以分号,句号作为切分。 """ text = remove_space(text) start = 0 result = [] groups =

2020-06-30 16:12:34 3228

原创 dokcer挂载本地目录

冒号之前是本地目录(宿主机目录),冒号之后是容器目录,要写成绝对路径(就是以斜线开头),否则会报错:docker run -it --name ner_gyn -v /opt/wwwroot/atom_guoyanan/lstm_trail:/lstm_trail tensorflow/tensorflow:2.1.0-gpu-py3 /bin/bash安装特定版本的tensorflow-addons:pip install tensorflow-addons==0.9.1 (适配tensorflo

2020-06-10 20:01:02 200

原创 台大hw1-预测pm25-手动实现gradient descent

Homework 1 - PM2.5 Predictionimport numpy as np import pandas as pd import matplotlib.pyplot as pltimport matplotlib as mpl# 先考虑比较简单的一种模型:# 9+1=10 个feature,9小时内所有pm2.5,bias# 清洗train data# 将所有的pm25数据放入到一个list中#%%def train(): all_pm25 = []

2020-05-22 16:21:31 216

原创 手动使用gradient descent求解linear model

假设有以下数据样本:import matplotlib.pyplot as pltimport matplotlib as mplimport numpy as npx_data = [338, 333, 328, 207, 226, 25, 179, 60, 208, 606]y_data = [640, 633, 619, 393, 428, 27, 193, 66, 226, 1591]# ydata = b + w*xdataplt.scatter(x_data, y_data)p

2020-05-21 16:00:37 173

原创 AI数据

Large Movie Review Dataset:This is a dataset for binary sentiment classification containing substantially more data than previous benchmark datasets. We provide a set of 25,000 highly polar movie reviews for training, and 25,000 for testing. There is addi

2020-05-15 14:44:43 220

原创 根据pid查看容器名

#!/bin/bash -e# Prints the name of the container inside which the process with a PID on the host is.function getName() { local pid="$1" if [[ -z "$pid" ]]; then echo "Missing host PID argument." exit 1 fi if [ "$pid" -eq "

2020-05-12 15:10:42 922

原创 python读取文件报错UnicodeDecodeError

读取文件时总是报错UnicodeDecodeError:‘utf-8’ codec can’t decode byte 0xe5 in position 23578431: invalid continuation byte:with open('data', mode='r', encoding='utf8') as f: lst = f.readlines() return lst解...

2020-03-24 15:47:21 655

原创 Linux分割合并文件

分割文件:每个文件划分1000行split -1000 file合并文件:任意多的文件合并成一个文件cat file1 file2 file3 > file

2020-03-20 09:57:30 141

原创 分离测评集数据

分离测评集数据是为了将原先混在一行的数据 变成一行是一行,方便自动化测评(至少半自动化)。先分离测评集数据,name和des分开放:fin = open("序列标注")fout1 = open("val_name", mode="w", encoding="utf8")fout2 = open("val_des", mode="w", encoding="utf8")for l in f...

2020-02-11 22:31:40 328

原创 logging模块使用

最详细的还是 官方文档最简单的使用# -*- coding:utf-8 -*-import logginglogging.debug('debug message')logging.info('info message')logging.warn('warn message')logging.error('error message')logging.critical('crit...

2020-02-06 23:13:27 161

原创 召回耗时

一直以为相似度的计算耗费时间,没想到召回耗时占了大头:def all_entity_dict(): tag_sys_path = "tags_clean.txt" # tag_sys_path = "/workdir/data/tags_clean.txt" f = open(tag_sys_path,"r",encoding="utf8") # 对 merge_all...

2020-02-05 23:24:38 255

原创 pickle使用

import picklevec_path = "entity_vec.pkl"with open(vec_path, 'wb') as fw: pickle.dump(vec_dic, fw)with open(vec_path, 'rb') as fr: vec_dic = pickle.load(fr)print(vec_dic["网络管理系统"][:5])#...

2020-02-05 17:48:10 155

原创 numpy求均值

import numpy as npa = [[1,1,1],[2,2,2]]print(np.mean(a, axis=0))# output[1.5 1.5 1.5]

2020-02-05 17:34:46 778

原创 git使用

git pushpush 当前分支遇到报错:[atom_guoyanan@kdd7224 project_recognize]$ git pushwarning: push.default is unset; its implicit value is changing inGit 2.0 from 'matching' to 'simple'. To squelch this messa...

2020-02-05 11:33:05 226

原创 基于gensim的lda实践2

import pandas as pdimport jiebafrom gensim.test.utils import common_textsfrom gensim.corpora.dictionary import Dictionaryfrom gensim.models.ldamodel import LdaModeldef jieba_add_words(): """...

2020-01-19 14:50:28 277 1

原创 docker从镜像启动容器, 从容器制作镜像

docker run -d --name=entity -m 32G -p $port:$port -v $dirpath:/workdir $img_name:$tag python /workdir/run_server.pydocker run -it --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=1 需要启动的docker名称 bashdo...

2020-01-16 16:43:16 900

原创 基于官方的tensorflow镜像来打镜像

Dockerfile:# FROM python:3.6# 基于的基础镜像# FROM tensorflow/tensorflow:latest-devel-gpu-py3# 1.12.0-gpu-py3 是基于python3.5.2的版本:FROM tensorflow/tensorflow:1.12.0-gpu-py3 #创建workdir文件夹RUN mkdir /work...

2020-01-16 16:02:28 1160

原创 linux查看端口占用情况

查看占用端口的进程:netstat -apn|grep <端口号>netstat -apn|grep 6606tcp 0 0 10.65.42.27:6606 172.22.142.20:62771 ESTABLISHED 9435/lighttpd杀掉该进程:kill -9 <pid>kil...

2020-01-15 20:32:08 150

原创 docker部署服务注意端口设置

在已有的容器中启动了一个etornado服务。先查看该容器暴露的端口:$ docker ps|grep gpu40f7eeff4f0f4 hub.ifchange.com/nlp/gpu4:20190917 "bash" 3 months ago Up 2 weeks ...

2020-01-14 16:23:28 904

原创 基于tornado的http服务框架

etornado地址:https://pypi.org/project/etornado/0.0.3/#historyetornado是tornado的进一步封装,使用起来更加方便。安装etornado 0.1.6版本,该版本基于python 3.6,所以:先用conda创建py36环境: conda create --name py36 python=3.6激活该环境:conda act...

2020-01-14 15:33:00 228

原创 pip默认镜像地址

pip默认镜像地址:https://pypi.org/simple# etornado=0.1.6 是基于python3.6的,其余都是基于3.7# etornado地址:https://pypi.org/project/etornado/0.0.3/#historypip install -i https://pypi.org/simple etornado=0.1.6 ...

2020-01-14 15:17:19 781

原创 git clone报错could not create work tree dir 'project_recognize'.: Permission denied

git clone报错:Permission denied$ git clone https://gitlab.ifchange.com/nb4/project_recognize.gitfatal: could not create work tree dir 'project_recognize'.: Permission denied因为当前的这个目录deploy是在docker中由...

2020-01-13 19:32:33 6504

原创 bilstm-crf

model.pyimport numpy as npimport os, time, sysimport tensorflow as tffrom tensorflow.contrib.rnn import LSTMCellfrom tensorflow.contrib.crf import crf_log_likelihoodfrom tensorflow.contrib.crf i...

2020-01-13 15:33:44 389

原创 根据词表获得预训练的字向量

根据词表获得预训练的字向量:import pickleimport tqdmimport numpy as npfrom nlutools import tools as nludef gene_embedding(): vocab_path = "./word2id.pkl" with open(vocab_path, 'rb') as f: word...

2020-01-13 15:31:30 384

原创 gensim加载bin格式的词向量模型

filepath = "/opt/wwwroot/atom_guoyanan/data/vector2.0/fasttext.bin"model = gensim.models.fasttext.load_facebook_vectors(filepath)print(model['核'])[ 0.1335077 0.9915103 0.28807437 0.7358422 ...

2020-01-13 15:18:17 1496

原创 tensorflow保存模型和导入模型

基于tf 1.12.0版本保存模型:import tensorflow as tf import numpy as np## 保存模型W = tf.Variable([[1,2,3],[1,2,3]],dtype=tf.float32, name="weights")b = tf.Variable([[1,1,1]], dtype=tf.float32, name="biases")...

2020-01-13 11:13:27 178

原创 实体链接

假设已经从一段文本中找到了实体序列,接下来要将序列链接到某一实体。链接策略:计算序列和每个实体的tf-similarity,召回阈值大于0.5的实体(及别名)计算序列和实体的余弦相似度:0.5*simi(序列,实体) + 0.5*top_simi(序列,别名s)以上得分top1就是序列最终链接到的实体code:import logging, osfrom tqdm import ...

2020-01-06 17:38:54 452

原创 shell中查看cpu的核数

cat /proc/cpuinfo| grep "cpu cores"| uniqcpu cores : 12

2019-12-26 15:00:12 1749

原创 mac安装selenium

下载seleniumpip install selenium下载chromedrive下载地址:ChromeDriver - WebDriver 选择相应版本进行下载。(tip: 需要科学上网)chromedrive解压后放到bin下放到跟lib同一级目录下的bin里:# 查看lib的路径pip --versionpip 19.0.3 from /Users/guoya...

2019-12-21 12:31:44 213

原创 git push时报错:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

产生报错:(base) ➜ git:(master) ✗ git push@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...

2019-12-17 15:03:46 771 1

原创 mac系统 使用vscode连接远程服务器

本机运行 ssh-keygen 生成公钥将公钥 “~/.ssh/id_rsa.pub” 内容复制到远程主机 ~/.ssh/authorized_keys 文件末尾本机.ssh/config 文件末尾增加如下设置:vscode 下载插件 Remote-SSH,点击左下角绿色按钮,cmd palatte中选择"connect to host":选择远程主机,输入对应的登录密码,连接成功。...

2019-12-16 16:54:39 5742

原创 docker 常用命令

进入运行中的容器docker exec -it f8ca205bad35 /bin/bashroot@f8ca205bad35:/profile# docker exec 进入,退出时容器继续运行;docker attach 进入,退出时容器停止运行(不建议用此命令)。运行容器(进入交互界面)docker run -it -p 52020:52020 -v /opt/us...

2019-12-13 11:55:26 128

Python for Data Analysis, 2nd Edition

学习用python进行数据分析的权威书籍,作者是pandas的开发者。2017年出版的 第二版,书中代码示例都更新到python3.6。目前没有中文翻译,只有英文版。

2018-04-12

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除