python
CrystalheartLi
路漫漫其修非常远兮,吾将上下左右前后而求索。
展开
-
ValueError: Connection error, and we cannot find the requested files in the cached path. Please...
Python使用transformers包的以下l两个函数加载bert时候,BertTokenizer.from_pretrained(bert_path)BertModel.from_pretrained(bert_path)报错:ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet c原创 2022-04-12 09:52:25 · 14761 阅读 · 7 评论 -
tensorflow1.X读取checkpoint(加载训练好的模型及参数)的两种方式
在模型训练的保存路径下面会保存有多个模型(如下图),下面介绍两种读取方式1,获取最新的保存的一个模型,比如上图的model-5200# model_path是checkpoints的路径,下面方法会自动寻找最新保存的一个模型ckpt_file = tf.train.latest_checkpoint(model_path)saver.restore(sess,ckpt_file)2,获取某个迭代次数的模型,比如要指定获取上图的model-5199ckpt_file=os.path.join(原创 2022-03-25 10:57:10 · 2813 阅读 · 2 评论 -
tensorflow.python.framework.errors_impl.DataLossError:Unable to open table file xxx perhaps ........
tensorflow加载预训练模型报错:tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file /home/chinese_L-12_H-768_A-12/bert_model.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file原创 2021-05-10 13:43:08 · 2434 阅读 · 0 评论 -
tensorflow_gpu与python、cuda、cudnn、gcc对应版本--官方最新
1,点击进入官方网址查看最新2,截至本文发表之前:Done!!!原创 2021-05-07 13:57:42 · 1801 阅读 · 1 评论 -
解决: ...HTTPError:404 Client Error: Not Found for url: https://pypi.tuna.tsinghua.edu.cn/simple/pip3/
更新pip3 报错:requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://pypi.tuna.tsinghua.edu.cn/simple/pip3/具体报错如下图:因为我使用的更新命令为:$ pip3 install -U pip3解决办法为,将命令改为:$ pip3 install -U pipDone!!!...原创 2021-05-07 13:19:33 · 12892 阅读 · 0 评论 -
python使用argparse模块实现在终端命令行传参
直接上代码import argparse# 定义终端要传送的参数parser = argparse.ArgumentParser(description="A description of what the program does")parser.add_argument('--num_send', '-n', default=100, type=int, help='Number of sends.')parser.add_argument("--time_sleep", '-s', defa原创 2021-04-14 12:42:00 · 678 阅读 · 0 评论 -
pip3 install XXX报错“python setup.py egg_info Check the logs for full command output.“
具体报错如下图:出错原因:pip3 与 setuptools版本比较低解决办法:$ python3 -m pip install --upgrade setuptools$ python3 -m pip install --upgrade pipDone!原创 2021-01-25 16:43:49 · 3779 阅读 · 0 评论 -
使用numpy实现期望极大(EM)算法
实现用例为李航统计学习方法第155页例9.1import numpy as np"""通过期望极大算法计算三硬币模型"""obs_arr = np.array([1, 1, 0, 1, 0, 0, 1, 0, 1, 1])num = len(obs_arr)para_init = {"π":0.4, "p":0.6, "q":0.7}'''E步,计算在模型参数π、p、q下观测数据y来自掷硬币B的概率'''def e_func(): u_j_i_b_arr = np.array原创 2021-01-05 20:10:37 · 412 阅读 · 0 评论 -
用numpy实现隐马尔科夫模型的概率计算问题(前向算法)
实现用例为李航统计学习方法第177页例10.2import numpy as np''' 用numpy实现隐马尔科夫模型的概率计算,即已知三元模型λ=(A,B,π)和观测序列O,计算在模型λ下观测序列O出现的概率P(O|λ)''''''一,定义模型的三要素''''''状态的集合'''def status_gener(status_len:int): status_list = [] for status_index in range(status_len):原创 2021-01-05 12:34:33 · 221 阅读 · 1 评论 -
Python多线程模拟多发送端使用mqtt向服务器thingsboard多设备接收端发送消息
https://www.cnblogs.com/emqx/p/11400733.htmlhttps://www.jianshu.com/p/0ed4e59b1e8f原创 2020-12-21 13:31:51 · 1804 阅读 · 1 评论 -
ubuntu18 安装以及更新pip2和pip3到最新版本
安装pip2:sudo apt install python-pip安装pip3:sudo apt install python3-pip原创 2020-12-16 13:48:51 · 980 阅读 · 0 评论