 <?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http://wiki.sseuu.com/index.php?action=history&amp;feed=atom&amp;title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97</id>
		<title>Huggingface之transformers零基础使用指南 - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.sseuu.com/index.php?action=history&amp;feed=atom&amp;title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97"/>
		<link rel="alternate" type="text/html" href="http://wiki.sseuu.com/index.php?title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97&amp;action=history"/>
		<updated>2026-05-10T22:29:17Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://wiki.sseuu.com/index.php?title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97&amp;diff=122100&amp;oldid=prev</id>
		<title>2023年11月1日 (三) 13:29 江南仁</title>
		<link rel="alternate" type="text/html" href="http://wiki.sseuu.com/index.php?title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97&amp;diff=122100&amp;oldid=prev"/>
				<updated>2023-11-01T13:29:58Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;http://wiki.sseuu.com/index.php?title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97&amp;amp;diff=122100&amp;amp;oldid=121652&quot;&gt;显示更改&lt;/a&gt;</summary>
		<author><name>江南仁</name></author>	</entry>

	<entry>
		<id>http://wiki.sseuu.com/index.php?title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97&amp;diff=121652&amp;oldid=prev</id>
		<title>2023年9月17日 (日) 13:24 江南仁</title>
		<link rel="alternate" type="text/html" href="http://wiki.sseuu.com/index.php?title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97&amp;diff=121652&amp;oldid=prev"/>
				<updated>2023-09-17T13:24:09Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;zh-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2023年9月17日 (日) 13:24的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;第1行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{4}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{4}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;前几篇博文中介绍了[[Transformer]]，由于其优越的性能表现，在工业界使用的越来越广泛，同时，配合迁移学习理论，越来越多的[[Transformer]]&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;预训练模型和源码库逐渐开源，&lt;/del&gt;'''[[Huggingface]]'''就是其中做的最为出色的一家机构。'''[[Huggingface]]'''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;是一家在NLP社区做出杰出贡献的纽约创业公司，其所提供的大量预训练模型和代码等资源被广泛的应用于学术研究当中。&lt;/del&gt;'''[[Huggingface]]'''所开源的[[Transformers]]&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;提供了数以千计针对于各种任务的预训练模型模型，开发者可以根据自身的需要，选择模型进行训练或微调，也可阅读api文档和源码， &lt;/del&gt;快速开发新模型。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;前几篇博文中介绍了[[Transformer]]，由于其优越的性能表现，在工业界使用的越来越广泛，同时，配合迁移学习理论，越来越多的[[Transformer]]&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[预训练模型]]和源码库逐渐开源，&lt;/ins&gt;'''[[Huggingface]]'''就是其中做的最为出色的一家机构。'''[[Huggingface]]'''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;是一家在NLP社区做出杰出贡献的纽约创业公司，其所提供的大量[[预训练模型]]和代码等资源被广泛的应用于学术研究当中。&lt;/ins&gt;'''[[Huggingface]]'''所开源的[[Transformers]]&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;提供了数以千计针对于各种任务的[[预训练模型]]模型，开发者可以根据自身的需要，选择模型进行训练或微调，也可阅读api文档和源码， &lt;/ins&gt;快速开发新模型。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;本篇博文，我们对'''[[Huggingface]]'''所开源的[[Transformers]]进行介绍。在此之前，请通过下行命令安装[[Transformers]]库：&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;本篇博文，我们对'''[[Huggingface]]'''所开源的[[Transformers]]进行介绍。在此之前，请通过下行命令安装[[Transformers]]库：&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot; &gt;第10行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第10行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Transformers]]库中提供了上百个算法模型的实现，有BERT模型对应的BertModel类，有BART对应的BartModel类……，每当我们使用对应的预训练模型时，都必须先找到对应类名，然后进行实例化，麻烦吗？非常麻烦！&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Transformers]]库中提供了上百个算法模型的实现，有BERT模型对应的BertModel类，有BART对应的BartModel类……，每当我们使用对应的预训练模型时，都必须先找到对应类名，然后进行实例化，麻烦吗？非常麻烦！&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;所以，[[Transformers]]&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;库中提供统一的入口，也就是我们这里说到的“AutoClass”系列的高级对象，通过在调用“AutoClass”的from_pretrained&lt;/del&gt;()&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;方法时指定预训练模型的名称或预训练模型所在目录，即可快速、便捷得完成预训练模型创建。有了“AutoClass”，只需要知道预训练模型的名称，或者将预训练模型下载好，程序将根据预训练模型配置文件中model_type或者预训练模型名称、路径进行模式匹配，自动决定实例化哪一个模型类，不再需要再到该模型在transfors库中对应的类名。“AutoClass”所有类都不能够通过init&lt;/del&gt;()方法进行实例化，只能通过from_pretrained()方法实例化指定的类。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;所以，[[Transformers]]&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;库中提供统一的入口，也就是我们这里说到的“[[AutoClass]]”系列的高级对象，通过在调用“AutoClass”的from_pretrained&lt;/ins&gt;()&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;方法时指定[[预训练模型]]的名称或[[预训练模型]]所在目录，即可快速、便捷得完成[[预训练模型]]创建。有了“[[AutoClass]]”，只需要知道[[预训练模型]]的名称，或者将预训练模型下载好，程序将根据预训练模型配置文件中model_type或者预训练模型名称、路径进行模式匹配，自动决定实例化哪一个模型类，不再需要再到该模型在[[transfors]]库中对应的类名。“[[AutoClass]]”所有类都不能够通过init&lt;/ins&gt;()方法进行实例化，只能通过from_pretrained()方法实例化指定的类。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;如下所示，我们到'''[[Huggingface]]'''官网下载好一个中文BERT预训练模型，模型所有文件存放在当前目录下的“model/bert-base-chinese”路径下。创建预训练模型时，我们将这一路径传递到from_pretrained()方法，即可完成模型创建，创建好的模型为BertModel类的实例。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;如下所示，我们到'''[[Huggingface]]'''官网下载好一个中文BERT预训练模型，模型所有文件存放在当前目录下的“model/bert-base-chinese”路径下。创建预训练模型时，我们将这一路径传递到from_pretrained()方法，即可完成模型创建，创建好的模型为BertModel类的实例。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>江南仁</name></author>	</entry>

	<entry>
		<id>http://wiki.sseuu.com/index.php?title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97&amp;diff=119334&amp;oldid=prev</id>
		<title>江南仁：创建页面，内容为“{{4}} 前几篇博文中介绍了Transformer，由于其优越的性能表现，在工业界使用的越来越广泛，同时，配合迁移学习理论，越来...”</title>
		<link rel="alternate" type="text/html" href="http://wiki.sseuu.com/index.php?title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97&amp;diff=119334&amp;oldid=prev"/>
				<updated>2023-01-25T10:39:41Z</updated>
		
		<summary type="html">&lt;p&gt;创建页面，内容为“{{4}} 前几篇博文中介绍了&lt;a href=&quot;/index.php?title=Transformer&quot; title=&quot;Transformer&quot;&gt;Transformer&lt;/a&gt;，由于其优越的性能表现，在工业界使用的越来越广泛，同时，配合迁移学习理论，越来...”&lt;/p&gt;
&lt;a href=&quot;http://wiki.sseuu.com/index.php?title=Huggingface%E4%B9%8Btransformers%E9%9B%B6%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97&amp;amp;diff=119334&quot;&gt;显示更改&lt;/a&gt;</summary>
		<author><name>江南仁</name></author>	</entry>

	</feed>