2021-11-16-python学习笔记

1.pip list
pip show
2.
不同参数传递测试
@pytest.mark.parametrize()

分组测试
将测试方法分为不同的测试组,测试时可以单独测试某个组的方法
markers=
@pytest.mark.g2

^B 放大命令行显示屏幕

  1.   fixture 'datadir' not found
    
  available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

4.flash 将参数由后端传给前端 需要对内容加密secret_key
5.flask-WTF表单
6.flask-sqlalchemy
7.模型继承db.Model
tablename 表名
db.relationship关系引用

8.需要给python配置虚拟环境

9.Union[str, None]

10.json.loads 和 json.load()

11.python3需要使用pip3来导入包

12.repr方法: 讲对象转化成解释器读取的形式

13.format方法的使用

14.@value.setter的作用:
@property:只读
@property,@*.setter:可读可写
@property @setter @.deleter 可读可写可删除

15.@staticmethod
@property :
在方法前加上@property,使得该函数可直接调用,封装起来
@classemethod:
在方法前加上@classmethod,则该函数变为类方法,该函数只能访问到类的数据属性,不能获取实例的数据属性
python自动传入位置参数cls就是类本身
cls.cla_name调用类自己的数据属性
@staticmethod:
静态方法,类或实例均可调用
改静态方法函数里不传入self或cls

16.not all?
all()函数用于判断给定的可迭代参数iterable中所有元素是否都为True,如果是返回True,否则返回False.
元素除了是0、空、 None 、 False 外都算True
函数等价于:
def all(iterable):
for element in iterable:
if not element:
return False
return True
python2.5以上版本可用.
空数组、空列表返回值为True,这里需要特别注意。

all([‘a’, ‘b’, ‘c’, ‘d’]) # 列表list,元素都不为空或0
True

all([‘a’, ‘b’, ‘’, ‘d’]) # 列表list,存在一个为空的元素
False

all([0, 1,2, 3]) # 列表list,存在一个为0的元素
False

all((‘a’, ‘b’, ‘c’, ‘d’)) # 元组tuple,元素都不为空或0
True

all((‘a’, ‘b’, ‘’, ‘d’)) # 元组tuple,存在一个为空的元素
False

all((0, 1, 2, 3)) # 元组tuple,存在一个为0的元素
False

all([]) # 空列表
True

all(()) # 空元组
True

17.comb = list(itertools.combinations(self, 2))
from itertools import combinations

list(combinations(‘ABC’, 2))
[(‘A’, ‘B’), (‘A’, ‘C’), (‘B’, ‘C’)]

itertools.combinations(iterable[, r]
创建一个迭代器,返回iterable中所有长度为r的子序列,返回的子序列中的项按输入iterable中的顺序排序 (不带重复).
r 指定生成排列的元素的长度,如果不指定,则默认为可迭代对象的元素长度。
对应组合概念。

18.test_results = list(map(lambda x: self._are_separate(*x), comb))

19.if not all(test_results):
overlapped_list = [comb[i] for i, v in enumerate(test_results) if not v]

20.def bind(self, host: “Sequence”):

21.def append(self, span) -> None:

22.def deepcopy(self, memodict={}):

23.@pytest.mark.skip(reason=“deprecated API”)

24.flag, _ = self.check_match(text)

25.text: Union[List[str], str],

26.extra_attr: Union[Mapping[str, Any], None] = None,

27.def add_extra_attr(self, **kwargs):

28.from typing import Union, Any, Mapping, List, Callable

29.def init(self, left: Corpus, right: Corpus):

30.test_tag_list = [i for i in test_tag_list]
test_tag_list.extend(
[None] * (gold_tag_list_len - test_tag_list_len)
)

4…rst文档的书写总结

5.pytest使用总结

3.可编辑安装

pip install .e

pip install -e <目录>
如果 使用sudo执行
sudo -H pip install -e <目录>

深度神经网络(Deep Neural Networks, 以下简称DNN)是深度学习的基础,而要理解DNN,首先我们要理解DNN模型,下面我们就对DNN的模型与前向传播算法做一个总结。

5.机器学习模型
线性模型

7.**kwargs

8.All In Local 模式和 Remtoe Wraper 模式。

9.小样本训练,生成NER模型

1. 芯片编程语言verlog

  1. tensorflow的relu怎么理解
    Relu激活函数(The Rectified Linear Unit) 表达式为:f(x)=max(0,x)。
    3.raise ImportError(‘Failed to import pydot. You must install pydot’
    ImportError: Failed to import pydot. You must install pydot and graphviz for pydotprint to work.
    4.loss=keras.losses.SparseCategoricalCrossentropy(from_logits=True)
    5.刚创建的springboot工程,maven unresolved plugin
    6.springboot项目刚启动时,页面访问不了?
    7.mongodb安装

1.loss=‘mec’ 平方差

loss=‘categorical_crossentropy’ 交叉熵
2.线性回归,非线性回归,menist分类,交叉熵,Dropout,正则化(regularizers),优化器(SGD,Adam),CNN应用于手写数字识别,RNN应用(循环神经网络),模型保存,模型载入,绘制网络结构(install pydot and graphviz) TB -> 从上往下,LR ->从左往右

1.jieba

2.fastext
3.textcnn

1.def call(self):

2.python工程编码规范
3.textCNN

1.from tensorflow.contrib import layers 已经引入tf1.15.2了,但仍然导入不了?

1.tensorflow的estimator框架

2.data_dir = self.native_config.pop(“data_dir”, “.”)
result_dir = self.native_config.pop(“result_dir”, “.”)
什么意思?
3.tensorflow的参数含义?
4.双向LSTM+CRF

离线NLU jar包已更新’com.ecarx.ai:enlu-allpack:1.0.3@jar’,现已支持除通讯录外的所有接口

20200402

1.keras中Flatten()函数的用法
2.sys.settrace(self.trace_dispatch)
PYDEV DEBUGGER WARNING:
sys.settrace() should not be used when the debugger is being used.
This may cause the debugger to stop working correctly.
If this is needed, please check:
http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html
to see how to restore the debug tracing back correctly.
Call Location:
File “/home/mike/anaconda3/envs/python36/lib/python3.6/bdb.py”, line 254, in set_trace
sys.settrace(self.trace_dispatch)

/home/mike/anaconda3/envs/python36/lib/python3.6/site-packages/tf_crf_layer/metrics/crf_accuracy.py(48)crf_accuracy()
-> crf, idx = y_pred._keras_history[:2]
(Pdb)

“”"
Ge default accuracy based on CRF test_mode.
“”"
#import pdb; pdb.set_trace()

3.ValueError: Input 0 of layer bidirectional is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: [None, 31, 64, 300]

20200403

1.理解lstm和cnn的输入输出
2.原来的数据集结果
3.keras fit函数,verbose的使用
4.未来的研究方向

我十分惊喜能看到大量的研究,其中研究者组合使用了 CNN 和 RNN,以获得两者的优势。一些研究甚至在混合网络中使用了 GAN,这非常有意思。

尽管这种组合模型似乎提供了更好的能力,但目前还有另一个新研究方向更受关注。该研究方向认为 CNN 自身就足以适用,RNN/LSTM 组合模型并非长久之计。

一组研究人员提出了一种新颖的深度森林架构。该架构嵌入在节点结构中,性能超出 CNN 和 RNN,并降低了计算资源和复杂度。

我们也关注着 Facebook 和 Google 这样的更主流方向。两家企业在近期停止在自己的语音互译产品中使用的基于 RNN/LSTM 的工具,转向使用 TCN(Temporal Convolutional Net)。

通常对于时序问题,尤其是对于文本问题,RNN 在设计上存在着固有的问题。RNN 一次读取并解释输入文本中的一个字(或字符、图像),因此深度神经网络必须等待直到当前字的处理完成,才能去处理下一个字。

这意味着 RNN 无法像 CNN 那样利用大规模并行处理(MPP)。尤其是为了更好地理解上下文而需要同时运行 RNN/LSTM 时。

这是一个无法消除的障碍,绝对会限制 RNN/LSTM 架构的效用。TCN 通过使用 CNN 架构解决这个问题。CNN 架构可以轻松实现“关注”(attention)和“跳门”(gate hopping)等新概念的 MPP 加速。

详细内容可参阅我们的论文原文:https://www.datasciencecentral.com/profiles/blogs/temporal-convolutional-nets-tcns-take-over-from-rnns-for-nlp-pred

当然,我无法做到概述整个研究领域。即便是针对最小延迟需求不像语音翻译那么严格的情况,我也做不到一一列出所有研究。然而,对于我们上面介绍的所有这些应用,似乎完全可以重新审视 TCN 这种新方法是否适用。

20200406

1.TQDM

20200415

1.小样本 fewshortlearning
2.三层,权重10,batch_size=64,20轮:0.9445
3.三层,权重1,batch_size=32,20轮:0.9461

20200423

1.python如何在命令行里指定运行环境?

20200427

2.模型融合:模型训练和评估
3.模拟器打超级玛丽
4.softmax和sigmoid有什么差异?
5.yolo
6.高等数学
7.搭建自己的gitlab
8.python中pickle的使用

模型融合:模型的训练和评估测试

模型融合:模型的训练和评估测试,了解BN和LN

27个属性 27个属性

20200428

模型融合:模型的训练和评估测试,了解BN和LN;选取小量的数据,验证focal_loss

20200506

1.模型融合:模型训练,在原来的模型基础上添加层训练,效果不是很好;看了一下米良的新模型并训练了一下。

1.模型融合:数据处理,看能否利用交叉验证,清洗分类和NER的数据

20200507

4.模型融合:多输入重启训练,准确率有提升;将使用米良修改过的的优化器进行训练,有效果。

1.模型融合:模型训练;数据处理

20200508

1.TSM
CTC
识别唇语

20200512

3.修改重启的位置,避免重新训练
4.训练完成后,修改学习率,重新开始训练

20200514

1.数据验证处理。
2.模型训练。

3.config = read_configure() 读取路径太恶心,需要优化,每次都需要读取根路径下的
4.byobu的使用

20200515

1.数据处理验证:新写了一版,但在模型推理的时候有点问题,结果是浮点数。
2.模型训练:调整参数,训练多输入模型。

4.python cls 的作用

5.四月拖欠的任务:
分享PPT
吴恩达课程过完
python深度学习代码全部过一遍
ZPP计划未完成

7.多模态

  1. 负责自然语言处理、计算机视觉等相关算法的研究与实现工作;

  2. 研究最新算法技术前沿进展,完成算法的验证,以及算法文档的整理;

  3. 多模态交互算法研究及应用落地;

  4. 计算机、图像处理、模式识别、机器学习等相关方向硕士及以上学历;

  5. 熟练掌握Tensorflow、PyTorch、Caffe等深度学习框架;

  6. 精通计算机视觉算法,具备图像识别、目标检测、目标跟踪等相关领域深度学习模型的实际开发和项目落地经验;

  7. 具有较强的逻辑思维能力、算法实现能力、沟通能力和团队组织协作能力;

  8. 熟练掌握Python、C++等编程语言;

  9. 具有宽广的技术视野,在某个具体方向上有深入研究和实践。

putty从服务器上下载文件命令
pscp -r lyj#tesla1.ecarx.ai:/home/lyj/mtnlp_model/results D:\desktop\111

在windows上使用pycharm连接tesla

20200518

3.远程连接服务器上的工程,弄熟
4.交叉验证,今天开发完

5.分享开始准备
6.每天看5节课
7.装上远程工具,连家里的电脑,每日计划完善起来
8.跑步,仰卧起坐,不许再偷懒
9.找一个点子
10.每天翻译一篇英文文献,必须严格执行下来
11.买一本书和空调小电池,防晒霜,护肤品

判断心情问候,打电话降低音量,注释中控屏,唤醒屏幕
长安最新车型

20200520

1.交叉验证问题:
标准的测试集如何构建?
如何在tesla上跑多任务?
日志的保存?
如何循环起来,使准确率跑到一定准确率停止?
使用多输入训练模型,进行多输入的优化?

2.2020-05-20 09:54:12.639003: E tensorflow/core/platform/default/device_tracer.cc:70] CUPTI error: CUPTI could not be loaded or symbol could not be found.
Traceback (most recent call last):
File “D:/Ecarx/02-Workspace/53-ubunuworkspace/mtnlp_model/mtnlpmodel/trainer/train.py”, line 302, in
main()
File “D:/Ecarx/02-Workspace/53-ubunuworkspace/mtnlp_model/mtnlpmodel/trainer/train.py”, line 257, in main
callbacks=callbacks_list,
File “D:\Ecarx\01-Tools\55-Anaconda\conda\envs\nlp_env\lib\site-packages\tensorflow_core\python\keras\engine\training.py”, line 727, in fit
use_multiprocessing=use_multiprocessing)
File “D:\Ecarx\01-Tools\55-Anaconda\conda\envs\nlp_env\lib\site-packages\tensorflow_core\python\keras\engine\training_arrays.py”, line 675, in fit
steps_name=‘steps_per_epoch’)
File “D:\Ecarx\01-Tools\55-Anaconda\conda\envs\nlp_env\lib\site-packages\tensorflow_core\python\keras\engine\training_arrays.py”, line 405, in model_iteration
callbacks._call_batch_hook(mode, ‘end’, batch_index, batch_logs)
File “D:\Ecarx\01-Tools\55-Anaconda\conda\envs\nlp_env\lib\site-packages\tensorflow_core\python\keras\callbacks.py”, line 236, in _call_batch_hook
batch_hook(batch, logs)
File “D:\Ecarx\01-Tools\55-Anaconda\conda\envs\nlp_env\lib\site-packages\tensorflow_core\python\keras\callbacks.py”, line 519, in on_train_batch_end
self.on_batch_end(batch, logs=logs)
File “D:\Ecarx\01-Tools\55-Anaconda\conda\envs\nlp_env\lib\site-packages\tensorflow_core\python\keras\callbacks_v1.py”, line 362, in on_batch_end
profiler.save(self.log_dir, profiler.stop())
File “D:\Ecarx\01-Tools\55-Anaconda\conda\envs\nlp_env\lib\site-packages\tensorflow_core\python\eager\profiler.py”, line 140, in save
gfile.MakeDirs(plugin_dir)
File “D:\Ecarx\01-Tools\55-Anaconda\conda\envs\nlp_env\lib\site-packages\tensorflow_core\python\lib\io\file_io.py”, line 438, in recursive_create_dir
recursive_create_dir_v2(dirname)
File “D:\Ecarx\01-Tools\55-Anaconda\conda\envs\nlp_env\lib\site-packages\tensorflow_core\python\lib\io\file_io.py”, line 453, in recursive_create_dir_v2
pywrap_tensorflow.RecursivelyCreateDir(compat.as_bytes(path))
tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: ./results/summary_log_dir\plugins\profile\2020-05-20_09-54-12; No such file or directory

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值