Paper: ELECTRA: PRE-TRAINING TEXT ENCODERS AS DISCRIMINATORS RATHER THAN GENERATORS
本来代码还没出来不想看的,不过前段时间确实太火了,先偷偷瞄一眼,看看到底是什么个情况。
核心思想:Replaced token detection Task + Transformer。
Paper: ELECTRA: PRE-TRAINING TEXT ENCODERS AS DISCRIMINATORS RATHER THAN GENERATORS
本来代码还没出来不想看的,不过前段时间确实太火了,先偷偷瞄一眼,看看到底是什么个情况。
核心思想:Replaced token detection Task + Transformer。
ThreadPool
Struct Using Compiler Driven Developmentnew
Worker
Struct Responsible for Sending Code from the ThreadPool
to a Threadexecute
Method1 | let foo = 5; // immutable |
1 | cargo doc --open // documents |
Post
and Creating a New Instance in the Draft Stateapprove
Method that Changes the Behavior of content
Deref
TraitBox<T>
Like a ReferenceDeref
TraitDrop
TraitRc<T>
the Reference Counted Smart PointerRefCell<T>
and the Interior Mutability PatternSync
and Send
TraitsReference counting smart pointer enables you to have multiple owners of data by keeping track of the number of owners and, when no owners remain, cleaning up the data.
References are pointers that only borrow data; in contrast, in many cases, smart pointers own the data they point to.
Smart pointers are usually implemented using structs. The characteristic that distinguishes a smart pointer from an ordinary struct is that smart pointers implement the Deref
and Drop
traits.
Deref
trait allows an instance of the smart pointer struct to behave like a reference so you can write code that works with either references or smart pointers. Drop
trait allows you to customize the code that is run when an instance of the smart pointer goes out of scope.本文主要介绍自然语言的记忆(存储与查询)模块,初衷是作为 chatbot 的 Layer 之一,主要功能是记忆(存储)从对话或训练数据学到的 “知识”,然后在需要时唤起(查询) 。目前成熟的方法是以图数据库作为载体,将知识存储为一系列的 ”节点“ 和 ”关系“。之后再基于这些存储的 ”节点“ 和 ”关系“ 进行相关查询。也可以理解为构建 Data Model 的问题。
项目地址:https://github.com/hscspring/NLM
图数据库的典型代表是 Neo4j,Neo4j 中有几个很重要的概念:标签、节点和关系。标签是一类节点,可以看作是节点的类别,节点一般是某一个实体;关系存在于两个实体间,可以有多种不同的关系。节点和关系可以有多个属性。实践来看,Python 语言可以使用社区的 technige/py2neo,当然还可以使用官方的 neo4j/neo4j-python-driver: Neo4j Bolt driver for Python,两者的目的都是将数据 import 进 database 并进行相应的查询。
Neo4j 的特点要求导入的数据尽量是结构化的,也就是我们要事先有实体和它的类别(实体的属性可有可无),实体与实体间的关系(关系的属性可有可无)。我们期待能从对话或无监督的语料中自动提取实体和关系,然后自动 import 进 Neo4j。为了避免导入数据的混乱,自然最好能有先验的 “类别”,比如节点类别 Person,Movie 等,关系类别 LOVES,ACTS 等。所以,对于文本输入,我们需要一个信息提取器,将文本中的符合先验类别的节点和关系提取出来。如果输入是 NLU 模块输出的 ”意图和实体“ ,则需要一个分类器,将意图分类到对应的 Relation 类别,将实体分类到 Node 类别。
Several weeks ago, we met a sort problem in our program of web app. We tried kinds of methods and finally have gotten a nearly 10 times performance improvement. The problem is very interesting and worth recording.
随着学习的不断深入,我们肯定会越来越不满足只在 Jupyter Notebook 中写一些小任务。我们可能会希望做一个 Web 应用,或者一个小程序,甚至是一个 APP。对于这种系统性的工程项目,框架就必不可少了,它可以极大地提高我们的效率。这节课我们就以 Python 的 Django 框架为例来开发一个小的 Web 应用程序。
这个系列的课程的目标在《在开始前》已经说得很清楚了:解决重复劳动或自己做好玩儿的小项目;尝试新的思维方式。这短短的几节课要想把 Python 的相关知识面面俱到是不可能的,但我觉得已经给出了一个全图景,大家只要围绕这个做,达到目标应该是不成问题的。我想说的还是一直提倡的:Just do it,在实践中不断成长。
学编程最重要的就是写代码、读代码。上节提到了要阅读大神的或优秀的代码,之前也一直在强调要动手实践,这节咱们关注下如何阅读源代码。好的源代码不仅能让我们学到关于编程的知识,而且还有如何思考问题、抽象业务、设计架构等等方面知识。
上节介绍了函数,简单理解就是实现特定功能的一组代码,方便复用。本节介绍的模块其实就是把函数组合起来作为模块,让更加便利地完成任务。使用模块我们可以非常迅速地实现很多任务,而不用自己动手实现。Python 中的模块分为内置的(Python 安装后就有的)和社区模块(需要通过 pip install xxx
安装的)。