怎么修改拉取源从指定的国内仓库拉取镜像?

由于docker hub下载速度很慢,一个70M的镜像,要下载很久,

1
2
3
4
5
6
7
8
9
10
11
12
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://rgr5cdlp.mirror.aliyuncs.com"],
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
}
}
EOF

ss

1
2
systemctl daemon-reload
systemctl restart docker

swarms

Docker Swarm是docker原生的集群管理工具,之前是个独立的项目,于 Docker 1.12 被整合到 Docker Engine 中,作为swarm model存在,因此Docker Swarm实际上有两种:独立的swarm和整合后swarm model。官方显然推荐后者,本文也使用swarm model。相较于kubernetes,Mesos等工具,swarm最大的优势是轻量,原生和易于配置。它使得原本单主机的应用可以方便地部署到集群中。

使用它,用户可以将多个 Docker 主机封装为单个大型的虚拟 Docker 主机,快速打造一套容器云平台。

1
2
$ docker images
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running

启动docker服务

1
systemctl start docker

mac上没有systemctl这个命令

监听的端口

参考 https://blog.csdn.net/M2l0ZgSsVc7r69eFdTj/article/details/78538819

docker build -f tensor2tensor-1.6.6 . -t bitspeech/tensor2tensor:1.6.6

自动化构建

除了在本地创建镜像然后使用push命令将其推送到Docker Hub之外,我们还可以使用Docker Hub提供的自动化构建技术在服务端直接构建镜像。通过在Docker Hub连接一个包含Dockerfile文件的Git Hub或Bit Bucket的仓库, Docker Hub的构建集群服务器就会自动构建镜像。通过这种方式构建出来的镜像会被标记为Automated Build,也可以称为受信构建(Trusted Build)。

help

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
$ docker --help

Usage: docker COMMAND

A self-sufficient runtime for containers

Options:
--config string Location of client config files (default
"/Users/bitmain/.docker")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level
("debug"|"info"|"warn"|"error"|"fatal")
(default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default
"/Users/bitmain/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default
"/Users/bitmain/.docker/cert.pem")
--tlskey string Path to TLS key file (default
"/Users/bitmain/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit

Management Commands:
checkpoint Manage checkpoints
config Manage Docker configs
container Manage containers # docker container ls 命令等价于 docker ps
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes

Commands:
attach Attach local standard input, output, and error streams to a running container # 常用
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
deploy Deploy a new stack or update an existing stack
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container # docker exec -it container_id bash 进入指定的容器
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images # 等价于 docker image ls
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers # 等价于 docker container ls
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers # 镜像运行后,是容器层。用docker ps查看容器
rmi Remove one or more images # 镜像是静态文件
run Run a command in a new container # 会运行一个新容器
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers # 容器stop后,仍然存在。
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE #
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes

Run 'docker COMMAND --help' for more information on a command.

位置信息

简介

  • 绝对位置信息:
    • 句首
    • 句尾
    • 做法:直接把位置编号当做特征
  • 相对位置信息(relative):
  • 上下文信息(context):

好像前两者都不重要,重要的是context信息。句首、句尾可以通过符号的LM来学习。

  • 平移不变性: 位置移动
    • ss
      -
      google
  • 周期性:与平移不变性很像

人工特征

naive 方法

直接把位置编号 [1,2,3,…n]作为一个维度。

缺陷:这样体现的是绝对位置信息。期望这种encoding具有平移不变性

常用方法

google提出的position encoding。

推荐系统中的时序信息:

  • FM中采用 last movie rated

学习特征

position embedding

通常采用position embedding + word embedding,比如:
ConvSeq2Seq,Transformer,等

优势:

  • 简单,易与word_embedding融合

缺陷:

  • 貌似没有考虑relative position

疑问

  • 是否能够学习到relative position
  • 两个embedding的融合为什么要采用加法,串起来呢?

position matrix ?

人工特征 + 学习特征

可以显式的加入位置信息,[1,2,3,…n]作为一个维度,能够体现位置的连续性,进而体现relative position。

但是绝对位置 1 2 3 不太靠谱,我们需要的仅仅是一个

扩展阅读

  • Convolutional Sequence to Sequence Learning | facebook
  • Attention is All Your Need | Google

维度尺寸设计 - 综述

实例分析

lexNet

ResNet

  • 整体架构一直在升维,没有升维的地方采用了residual connection
  • 单个block结构:降维(11small_size) + 卷积(33small_size) + 升维(11large_size)。

NIN

GoogLeNet

Transformer

先升维再降维

inception网络中的1*1卷积

先降维再升维

1×1 layers reducing and then increasing (restoring) dimensions, leaving the 3×3 layer a bottleneck with smaller input/output dimensions.

1*1 kernel

可用于降维,可用于升维。

NIN中用于降维

1
2
    input       conv
[?*100*100*128] * [1*1*128*32]

bottleneck设计