自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Eureka

真的只是瞎逼写写,大家就当看个乐呵......

  • 博客(101)
  • 收藏
  • 关注

转载 GIT Commit to an existing Tag

Original page: https://gist.github.com/danielestevez/2044589Create a branch with the taggit branch {tagname}-branch {tagname}git checkout {tagname}-branchInclude the fix manually if it’s just ...

2019-08-06 01:45:14 266 1

原创 Keep a fork up to date

想要使得自己fork下來的repo和原來fork的對象保持一致。git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.gitgit fetch upstreamgit merge upstream/master master...

2019-05-14 22:30:22 246

原创 .img/.hdr格式转.nii格式的方法

MATLAB转格式,需要使用spm package(https://github.com/neurodebian/spm12).%%img2nii.m--------------------------------------------%Script to convert hdr/img files to nii.%This script uses SPM function, so you...

2019-03-14 05:29:07 5463 2

原创 Python ArgumentParse的subparser用法

在写一些很小的机器学习项目的时候,我们往往希望training, testing和inference能共用一个入口main,但是不同的功能使用不同的input参数.当然如果三个功能对应三个.py脚本问题也不大,但是毕竟觉得不太优雅.这个时候就需要考虑如何让代码更加简单有条理.主要是最近在看parser有关的东西,所以看到了一个项目,里面的使用subparser的地方是值得借鉴的,下面附上代码和部...

2019-03-13 22:40:26 5250 1

原创 Dependency Parsing评估方法(evaluation metrics)小记

本文部分翻译自文章Dependency parsing外加个人批注以及关于如何在Python中具体实现的小笔记.Kübler, Sandra, Ryan McDonald, and Joakim Nivre. “Dependency parsing.” Synthesis Lectures on Human Language Technologies 1.1 (2009): 1-127.评估d...

2019-03-13 08:28:28 861

原创 numpy奇技淫巧篇

找出符合条件的元素的index:How to find the index of elements that satisfy certain conditions, at first, I think I can use a loop to realize it … but now that there exists lib … why bother to do that …np.argwhe...

2019-02-09 04:08:09 667 1

原创 TensorFlow奇技淫巧之快速读模型的部分参数

菜鸡笔记,不喜莫喷现在有一个完整的Transformer模型,但是我只想分析它Layer Normalization的参数;其他10810^8108左右的参数我不想看,看到就头大。已知这部分参数的名字大概有如下的patternlayer_prepostprocess/layer_norm/layer_norm_scale和layer_prepostprocess/layer_norm/la...

2019-02-08 03:20:22 447

原创 TensorFlow:数参数的总个数

没啥可说的,直接上脚本import tensorflow as tfmeta_graph_path = '/path-to-your-.meta-file'load_mod = tf.train.import_meta_graph(meta_graph_path)total_parameters = 0for variable in tf.trainable_variables():...

2019-02-07 06:18:46 1348

原创 Expect script登录remote server

由于所在实验室的server实在是太多了…而且一般中间还有两个jumpserver…这个人又实在是太懒了,就瞎扣jio写了个差不多能用的expect脚本来方便登录各个服务器#!/usr/bin/expectset timeout -1send_user "Log into XXX Remote Server\n"### Prepare the variableset ECN_USER...

2019-01-11 02:34:22 244

原创 gdb调试C的一些小笔记

单纯只是自己在写ECE637这门课的时候想把代码吃透一些才搞这些的,开这篇文章也只是单纯的自己记性不好而已。一般操作1. 带参数的gdbYou can run gdb with --args parametergdb --args executablename arg1 arg2 arg32. 切换tui窗口方案一:gdb -tui executablename方案二:先使用...

2019-01-04 10:14:49 191

转载 Interesting Problems about Conditional Distribution

If X and Y are independent Poisson RVs with respective means λ1 and λ2, find the conditional pmf of X given X + Y = n and the conditional expected value of X given X + Y = n.Consider n + m independen...

2018-12-13 05:13:06 443

转载 ubuntu设置主屏和副屏

作为一个程序员,从开始使用双屏之后,一个显示屏开发,那种感觉,就是不好。好吧,刚换到ubuntu,笔记本一个显示屏,外接了一个HDMI的显示器,由于书桌的位置,只有把HDMI的显示屏放在笔记本的左边。但是,默认的,是笔记本的显示屏是主屏,右边是外接的显示屏,一种乱了套的感觉。想去左边的屏,需要往右滑,想去右边的屏,需要往左滑。不过还好有 xrandr,试了一下,三条命令:venn@sprin...

2018-12-12 04:43:55 715

原创 MATLAB command line workflow

If you could not use MATLAB desktop on server, you have no other choice but to use MATLAB command line version. Here are some notes of mine:1. Running MATLAB on server without GUImatlab -nodesktop...

2018-11-26 09:49:29 444

原创 Linux cannot connect to X server

I want to use wb_view on remote server and view it from local client. However, when I use ssh user@localhost to login to the server, it reports errors as following.wb_view: cannot connect to X server...

2018-11-26 02:36:46 3991

原创 Linux: the fastest way to view images from the terminal

It is extremely easy to view images from your personal PC, however, if you are in a server without root privilege, you will need some tricks to view images. Here are the fastest way:Enter the folder...

2018-11-26 01:14:20 165

原创 docker: user namespace

One of the problem I met yesterday is that I add my user on GPU server to the docker group and run a DL docker container. Although I once firmly believed that the root in docker is virtual for the rea...

2018-11-16 05:25:44 355

原创 R lang Basic Operation

How to select certain rows with specific row names from a data frame in Rstackoverflow: https://stackoverflow.com/questions/18933187/how-to-select-some-rows-with-specific-row-names-from-a-data-frame...

2018-11-12 23:30:01 284

原创 A Record of Ubuntu apt

1. Get a list of repositories apt-get is checkinggrep -h ^deb /etc/apt/sources.list /etc/apt/sources.list.d/*2. Remove a repositoryRemove it from sources.list.If it was added by add-apt-reposito...

2018-11-08 06:06:56 204

转载 Ubuntu Files Permissions - chmod

Original Article: https://www.linux.org/threads/file-permissions-chmod.4124/Linux has inherited from UNIX the concept of ownerships and permissions for files. This is basically because it was conceiv...

2018-11-02 05:55:11 426

原创 docker: deploy a deep learning environment manually

Since currently a server is shared between numerous lab members, I usually need to run my code with non-root environment. All too often, I find it is indispensable to install new packages and polish t...

2018-11-01 06:39:57 199

原创 docker: delete operation

kill all running containersdocker kill $(docker ps -q)delete all stopped containersdocker rm $(docker ps -a -q)delete all imagesdocker rmi $(docker images -q)

2018-11-01 04:35:39 394

原创 docker: mange docker as a non-root user

When first installing docker, you will find it requires root priority for even docker run operation. So you should create a group for non-root users to run their code.https://docs.docker.com/install...

2018-11-01 04:31:59 921

转载 Normalization method

相关资料What’s the difference between layer normalization and batch normalization?https://stackoverflow.com/questions/44941231/can-i-use-layer-normalization-with-cnnTensorFlow code of batch norm/layer ...

2018-10-26 01:52:26 169

转载 Python nicest way to pad zeroes to a string

Strings:>>> n = '4'>>> print n.zfill(3)004And for numbers:>>> n = 4>>> print '%03d' % n004>>&

2018-10-25 03:24:36 151

原创 Linux remove the files whose names match a certain pattern

Use find command to find all of the files firstfind . -name '*.jpg If the files shown are exactly the ones that you want, you can delete them with the following command:find . -name '*.orig' #-del...

2018-10-23 06:02:57 184

原创 Python MemoryError Problem

Python的内存管理相对于C++来说相当低效已经是老生之谈了。今天遇到了一个内存问题,大概是我想拿30000×51230000\times{512}30000×512的一个矩阵来和它自己的转秩做类似内积的运算。在Python中查看一个变量占多少内存的指令如下:import numpy as npfrom sys import getsizeofa = [0] * 1024b = np.a...

2018-10-15 02:42:09 2087

原创 Python 环境部署之readline以及no root权限下的挣扎

如果是源码安装Python而非使用Anaconda全家桶的话,进入Python往往会遇到这样的情况:使用Left,Right,Up来控制光标的移动以及输入历史命令会无效,而是显示诸如Left(^[[D), Right(^[[C), Up(^[[A)的情况。这里主要是少了dev version of the ncurses5 library。只需要执行sudo apt-get install li...

2018-10-13 03:51:42 763 1

原创 Linux learn awk and sed to a minimal limit (Keep Updating)

1 IntroductionMy work mostly focuses on natural language processing, which means I spend lots of time dealing with text files. From the bottom of my heart (maybe not right), I believe the cleansing p...

2018-10-12 06:52:06 342

原创 Tensor2Tensor GPU Memory Error During Training

When I was training Transformer based on 12M+ source sentences and equal number of target sentences (batch size equals 4096, platform is 4×TITANXp4\times{TITAN Xp}4×TITANXp), it reports error like thi...

2018-10-11 04:03:45 1085

转载 Linux文本搜索

寻找特定文件名的命令find /path/to/search -name "fileofinterest.txt"在文件夹下就内容的关键词进行查询,摘自How do I find all files containing specific text on Linux?Do the following:grep -rnw '/path/to/somewhere/' -e 'pattern...

2018-10-10 06:11:46 627

原创 Linux 深度学习训练log debug工作流

程序运行输出重定向:这里我使用的脚本是./translate_enzh_train.sh,根据具体情况修改这个。一般会结合nohup或者disown使用。./translate_enzh_train.sh 1>>suc.txt 2>>err.txt对Log进行实时观测watch -n 10 tail -n 15 err.txt 每10秒就在屏幕上打印输出log...

2018-10-09 23:36:33 642

原创 Linux Vim 分屏使用小记

Open multiple screens::split /path/to/file split the screen vertically with original file and new fileSwitch between different screens:Control+W followed by W to toggle between open windows and,Co...

2018-10-09 23:00:39 223

原创 Linux后台运行程序命令

将命令在后台运行最常见的是nohup命令,这里不赘述,具体可参考:https://www.jianshu.com/p/fcc8894923f7而最常发生的是,我们直接运行了一个命令,但是没有使用nohup,后期又希望能够让这个程序在后台运行,即使关闭了当前的terminal,程序也能如旧运行,这个时候往往需要ctrl+zbgdisown关于disown的细节可参考:https:/...

2018-10-09 22:21:10 1427

原创 Linux查看CPU信息以及其他

查看当前系统内核信息uname -a查看当前操作系统发行版信息Ubuntu 18.04.1 LTS \n \l查看CPU型号cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -cYou can get: 4 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHzInterpret th...

2018-10-09 01:54:05 930

原创 【Git】使用手册个人版

由于最近开始在新的公司上班了,终于告别了技术咨询的工作…感觉半年智商真的掉了不少,能够回来做开发/Research真的开心,上班的时候都在傻笑,感觉对面的小伙成天看智障的一样看着我…… 废话不多说了,先上个阅读链接。中文版Pro Git https://git-scm.com/book/zh/v2zh改成en就是英文版啦这篇博文主要是我在阅读这份Pro Git的时候在最关键的地方做...

2018-02-28 07:54:11 333

原创 【C++】学习笔记草稿版18(模板)

泛型(Generic Programming)即是指具有在多种数据类型上皆可操作的含义。泛型编程的代表作品STL是一种高效、泛型、可交互操作的软件组件。 泛型编程最初诞生于C++中,目的是为了实现C++的STL(标准模板库)。其语言支持机制就是模板(Templates)。模板的精神其实很简单:参数化类型。换句话说,把一个原本特定于某个类型的算法或类当中的类型信息抽调,抽出来做成模板参数T。...

2018-02-23 21:57:29 352

原创 【C++】学习笔记草稿版17(运行时类型信息RTTI)

C++的多态是通过一张虚函数表(Virtual Table)来实现的,简称为V-Table。在这个表中,主要是一个类的虚函数的地址表,这张表解决了继承、覆写的问题,保证其真实反映实际的函数。这样,在有虚函数的类的实例中这个表被分配在了这个实例的内存中,所以,当我们用父类的指针来操作一个子类的时候,这张虚函数表就显得尤为重要了,它就像一个地图一样,指明了实际所应该调用的函数。C++的编译器应该是...

2018-02-23 21:30:24 283

原创 【C++】学习笔记草稿版16(基于多态的设计模式)

C++中有一种设计原则叫依赖倒置。也是给予多态的。 定义:高层模块不应该依赖低层模块,两者都应该依赖其抽象。抽象不应该依赖细节。细节应该依赖抽象。问题由来:类A直接依赖类B,如果要将类A改为依赖类C,则必须要通过修改类A的代码来达成。这种场景下,类A一般是高层模块,负责复杂的业务逻辑;类B和类C是低层模块,负责基本的原子操作;假如修改类A,会给程序带来不必要的风险。解决方案:将类A修改为...

2018-02-23 16:11:37 346

原创 【C++】学习笔记草稿版15(多态)

多态(PolyMorphism) 如果有几个相似而不完全相同的对象,有时人们要求在向它们发出同一个消息时,它们的反应各不相同,分别执行不同的操作。这种情况就是多态现象。 例如,甲乙丙3个班都是高二年级,他们有基本相同的属性和行为,在同时听到上课铃声的时候,他们会分别走向三个不同的教室,而不会走向同一个教室。 又如在windows环境下,用鼠标双击一个对象(这就是向对象传递一个消息),如果对象...

2018-02-23 10:28:08 361

原创 【C++】学习笔记草稿版14(继承与派生)

继承与派生 (inherit & derive)表达的是一个意思。 在C++中可重用性(software reusability)是通过继承(inheritance)这一机制来实现的。如果没有掌握继承性,就没有掌握类与对象的精华。#if 0学生 姓名, 年龄, 性别, 学号, 吃饭, 学习老师 姓名, 年龄, 性别, 工号, 吃饭, 教学抽取: 姓名, 年龄, 性别, 吃...

2018-02-21 22:51:05 235

空空如也

空空如也

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

TA关注的人

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