• 机器学习1


    TensorBoard: 为了方便TensorFlow程序的理解、调试与优化,于是有了TensorBoard这样的可视化工具
    tensorboard --logdir="./": 将日志存储到./

    错误:

    Bad key "text.kerning_factor" on line 4 in
    /home/sunhongxuan/anaconda3/envs/tf_gpu_env/lib/python3.6/site-packages/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle.
    You probably need to get an updated matplotlibrc file from
    http://github.com/matplotlib/matplotlib/blob/master/matplotlibrc.template
    or from the matplotlib source distribution
    
    • 1
    • 2
    • 3
    • 4
    • 5

    原因:
    一个名为"text.kerning_factor"的key失效引起的版本冲突,我理解的是matplotlib旧版本需要这个key,新版本不需要了;
    解决方案:
    根据提示找到这个key并注释掉

    错误:

    UserWarning: NumPy 1.14.5 or above is required for this version of SciPy (detected version 1.13.1)
      UserWarning)
    
    • 1
    • 2

    原因:
    Numpy版本不匹配,更新版本之后tensorboard版本有不匹配
    解决方案:
    全部卸载,重新下载所有内容:
    CUDA:
    查看推荐版本:ubuntu-drivers devices

    sunhongxuan@sunhongxuan-MateBook-X-Pro:~$ ubuntu-drivers devices
    == /sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0 ==
    modalias : pci:v000010DEd00001D52sv00001E83sd00003E21bc03sc02i00
    vendor   : NVIDIA Corporation
    model    : GP108BM [GeForce MX250]
    manual_install: True
    driver   : nvidia-driver-450-server - distro non-free
    driver   : nvidia-driver-515-server - distro non-free
    driver   : nvidia-driver-418-server - distro non-hfree
    driver   : nvidia-driver-470-server - distro non-free
    driver   : nvidia-driver-510 - distro non-free
    driver   : nvidia-driver-515 - distro non-free recommended
    driver   : nvidia-driver-470 - distro non-free
    driver   : nvidia-driver-510-server - distro non-free
    driver   : xserver-xorg-video-nouveau - distro free builtin
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    此时终端输入sudo ubuntu-drivers autoinstall即可自动安装,或者输入sudo apt install nvidia-driver-515安装,然后重启系统即可。
    nvidia--smi查看CUDA版本为:

    Thu Oct 13 16:10:27 2022       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 515.65.01    Driver Version: 515.65.01    CUDA Version: 11.7     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |                               |                      |               MIG M. |
    |===============================+======================+======================|
    |   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 Off |                  N/A |
    | N/A   58C    P8    N/A /  N/A |      4MiB /  2048MiB |      0%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
                                                                                   
    +-----------------------------------------------------------------------------+
    | Processes:                                                                  |
    |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
    |        ID   ID                                                   Usage      |
    |=============================================================================|
    |    0   N/A  N/A      1195      G   /usr/lib/xorg/Xorg                  4MiB |
    +-----------------------------------------------------------------------------+
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    但是tensorflow最高支持到CUDA11.2

    tensorflow-gpu版本安装失败,安装cpu版本

    TensorFlow 2.6.0
    python 3.6
    keras 2.6.0
    numpy 1.19.5
    
    • 1
    • 2
    • 3
    • 4

    问题:

    AttributeError: module 'keras.utils' has no attribute 'to_categorical'
    
    • 1

    解决方案:
    from keras import utils改为from keras.utils import np_utils,然后将文件中的until改为np_utils

    问题:

    libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: 无法打开共享对象文件: 没有那个文件或目录 (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
    libGL error: failed to load driver: iris
    libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: 无法打开共享对象文件: 没有那个文件或目录 (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
    libGL error: failed to load driver: iris
    libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: 无法打开共享对象文件: 没有那个文件或目录 (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
    libGL error: failed to load driver: swrast
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    出现这种情况很可能是核显和独显同时使用了,在ubuntu下的解决方案是:

    1.确定自己安装了显卡驱动(终端输入nvidia-smi,可以查看是否有输出信息,如果有就是安装了)

    2.终端输入nvidia-settings,弹出nvidia settings设置窗口,点击左侧的最后一项PRIME Profiles,选择NVIDIA(Performance Mode),然后重启。

    问题:

    findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans.
    
    • 1

    原因:
    因为是在ubuntu环境下运行的,所以没有windows中的黑体字,下载后就可以了
    其实就是matplotlib输出的图片中中文乱码
    解决方案:
    参考博客:点我点我

    警告:

    2022-10-20 15:42:48.204776: E tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_SYSTEM_DRIVER_MISMATCH: system has unsupported display driver / cuda driver combination
    2022-10-20 15:42:48.204907: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: sunhongxuan-MateBook-X-Pro
    2022-10-20 15:42:48.204933: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: sunhongxuan-MateBook-X-Pro
    2022-10-20 15:42:48.205149: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:200] libcuda reported version is: 510.85.2
    2022-10-20 15:42:48.205231: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:204] kernel reported version is: 515.76.0
    2022-10-20 15:42:48.205255: E tensorflow/stream_executor/cuda/cuda_diagnostics.cc:313] kernel version 515.76.0 does not match DSO version 510.85.2 -- cannot find working devices in this configuration
    2022-10-20 15:42:48.206055: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
    To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    原因:
    表明 CPU 支持AVX AVX2 (可以加速CPU计算),但是你安装的 TensorFlow 版本不支持
    解决方案:

    1. 不管他
    2. 可以卸载原来版本的tensorflow,安装cuda和cudnn和tensorflow对应的版本
      采用方案1,防止再次崩溃
  • 相关阅读:
    怎么将内容做成活码二维码?快速实现活码制作的方法
    【无标题】
    【博客468】ECMP(等价多路径)环境下链路偶发故障排查
    [De1CTF2019]Babylfsr
    我的2023年:程序员的自我迭代、技术复盘与生活点滴
    React.FC(函数式组件)与React.Component(类组件)使用和区别
    9、设计模式之组合模式(Composite)
    Moxa NPort 设备缺陷可能使关键基础设施遭受破坏性攻击
    P1433 吃奶酪
    Int64针对32位架构是按照4字节还是8字节对齐?
  • 原文地址:https://blog.csdn.net/sunhongxuan666/article/details/127303349