Skip to content

Instantly share code, notes, and snippets.

View nanmi's full-sized avatar
😉
Atypical AI practitioners

nanmi

😉
Atypical AI practitioners
View GitHub Profile
@nanmi
nanmi / system_type.py
Last active March 31, 2021 01:19
python查看系统平台类型
import platform as plat
system_type = plat.system() # 由于不同的系统的文件路径表示不一样,需要进行判断
@nanmi
nanmi / read_ini_file.py
Last active January 13, 2021 08:19
python ini文件读取
import configparser
config = configparser.ConfigParser()
config.read({file}.ini)
config['FILE_DATA']['path']
@nanmi
nanmi / arguments.py
Last active December 27, 2019 07:36
在命令行即可运行的--arguments的参数选项设置方法
import argparse
def get_args():
parser = argparse.ArgumentParser(description='整个参数列表的自定义名称')
parser.add_argument('--{argument参数提示符}',type={int/str...数据输入类型},default={默认数据},help='{命令提示内容}':q)
return parser.parse_args()
args = get_args()
args.{argument参数提示符}
@nanmi
nanmi / tensorboard.py
Last active January 13, 2021 08:24
tensorboard check loss or accuracy
summary_writer = tf.summary.FileWriter('./logs', sess.graph)
train_summary = tf.Summary(value=[tf.Summary.Value(tag='train_loss', simple_value=train_loss),
tf.Summary.Value(tag='train_accuracy', simple_value=train_acc)
])
test_acc, test_loss, test_summary = Evaluate(sess)
summary_writer.add_summary(summary=train_summary, global_step=epoch)
summary_writer.add_summary(summary=test_summary, global_step=epoch)
@nanmi
nanmi / install nvidia-docker2.md
Last active January 13, 2021 09:21
Install nvidia-docker2 on CentOS&Ubuntu

CentOS 安装nvidia-docker2 2.1设置仓库

$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo

2.2更新仓库中的key

$ DIST=$(sed -n 's/releasever=//p' /etc/yum.conf)
@nanmi
nanmi / 自定义SHELL LOGO.md
Last active March 30, 2021 10:25
自定义SHELL LOGO

自定义logo

$ vim /etc/ssh/sshd_config
#文档末尾加入
Banner /etc/ssh/my_banner

创建

@nanmi
nanmi / 搭建mysql容器并远程连接.sh
Last active January 13, 2021 08:22
搭建mysql容器并远程连接
#启动容器
docker run -it --rm --name mysql -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 -d mysql
#进入容器
apt-get update
passwd #设置密码
apt-get install ssh openssh-server vim
#修改/etc/ssh/sshd_config 修改为PermitRootLogin yes和修改为UsePAM no
$ mysql -uroot -p123456 或 (mysql -uroot -p )
@nanmi
nanmi / pybind11编译和使用.md
Last active June 15, 2021 04:51
pybind11编译和使用

pybind11编译和使用

download pybind11 project

$ git clone https://github.com/pybind/pybind11.git

install pytest

$ pip install pytest
@nanmi
nanmi / 安装nvidia-container-runtime.md
Last active March 11, 2023 01:00
不安装nvidia-docker2,容器使用宿主机gpu

docker 19.03已经正式发布了,这次发布对我来说有两大亮点。

  • 就是docker不需要root权限来启动和运行了
  • 就是支持GPU的增强功能,我们在docker里面想读取nvidia显卡再也不需要额外的安装nvidia-docker了

安装NVIDIA Container Runtime

cat nvidia-container-runtime-script.sh

curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | \
  sudo apt-key add -
@nanmi
nanmi / hivedscheduler GPU.md
Last active January 13, 2021 08:21
how to configure services-configuration.yaml