zoukankan      html  css  js  c++  java
  • 【21年02月-气象海洋时序预测】DW打卡02

    前情回顾

    上述存在问题

    • 问题1:每次更新代码后,再重新执行dockerfile,会重新安装一遍tensorflow==2.2.0的包比较耗时耗内存
    • 问题2:每次执行完,会自动把整个镜像推送到阿里云的远程镜像库

    解决问题1

    调整dockerfile的构建命令,极大程度使用docker构建时的缓存的layer —— 把pip install的命令提前,Add命令放在后面;
    dockerfile简单来说是一个栈结构的命令构筑库,带缓存的,从头开始的连续的构建片段可以被再次执行相同命令的dockerfile脚本立即使用。

    更多见:菜鸟教程——Dockerfile说明

    更改前的dockerfile

    FROM registry.cn-shanghai.aliyuncs.com/tcc-public/tensorflow:latest-cuda10.0-py3
    
    ## Install Requirements(requirements.txt包含python包的版本)
    ## 这里使用清华镜像加速安装
    RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ --upgrade pip
    RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt
    #RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt
    
    
    ## 把当前文件夹里的文件构建到镜像的根目录下(.后面有空格,不能直接跟/)
    ADD . /
    
    ## 指定默认工作目录为根目录(需要把run.sh和生成的结果文件都放在该文件夹下,提交后才能运行)
    WORKDIR /
    
    ## 镜像启动后统一执行 sh run.sh
    CMD ["sh", "run.sh"]
    

    更改后

    FROM registry.cn-shanghai.aliyuncs.com/tcc-public/tensorflow:latest-cuda10.0-py3
    
    ## Install Requirements(requirements.txt包含python包的版本)
    
    # 之前的写法
    #RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt
    ## 这里使用阿里云的镜像加速安装
    
    # 改进后的写法
    RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ --upgrade pip
    RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ numpy
    RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ tensorflow==2.2.0
    
    
    ## 把当前文件夹里的文件构建到镜像的根目录下(.后面有空格,不能直接跟/)
    ADD . /
    
    ## 指定默认工作目录为根目录(需要把run.sh和生成的结果文件都放在该文件夹下,提交后才能运行)
    WORKDIR /
    
    ## 镜像启动后统一执行 sh run.sh
    CMD ["sh", "run.sh"]
    

    更改后的优势

    重复提交了一次,秒push。

    解决问题2

    使用命令的模式,拆分步骤。
    见上篇教程的2.2 服务器上直接操作的部分:

    https://tianchi.aliyun.com/competition/entrance/231759/tab/226

    其他截图

    优化思路

    初学了一下tf和神经网络的内容,借鉴了https://www.cnblogs.com/shepherd1701/p/14449793.html 的激活函数的调整思路

    你不逼自己一把,你永远都不知道自己有多优秀!只有经历了一些事,你才会懂得好好珍惜眼前的时光!
  • 相关阅读:
    1024X768大图 (Wallpaper)
    (Mike Lynch)Application of linear weight neural networks to recognition of hand print characters
    瞬间模糊搜索1000万基本句型的语言算法
    单核与双核的竞争 INTEL P4 670对抗820
    FlashFTP工具的自动缓存服务器目录的功能
    LDAP over SSL (LDAPS) Certificate
    Restart the domain controller in Directory Services Restore Mode Remotely
    How do I install Active Directory on my Windows Server 2003 server?
    指针与指针变量(转)
    How to enable LDAP over SSL with a thirdparty certification authority
  • 原文地址:https://www.cnblogs.com/zhazhaacmer/p/14432000.html
Copyright © 2011-2022 走看看