初始化项目,由ModelHub XC社区提供模型

Model: TheBloke/Yi-34B-200K-Llamafied-GPTQ
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-08-19 00:27:13 +08:00
commit d8e954f003
12 changed files with 1178 additions and 0 deletions

36
.gitattributes vendored Normal file
View File

@@ -0,0 +1,36 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
model.safetensors filter=lfs diff=lfs merge=lfs -text

323
LICENSE Normal file
View File

@@ -0,0 +1,323 @@
Yi Series Models License Agreement
Version: 2.0
Date of Release: November 4, 2023
1. Definition
“Agreement” refers to the terms and conditions defined in this Yi Series Models
License Agreement for the use, reproduction and distribution of Yi Series
Models.
“Model” refers to associated components (including checkpoints) developed based
on machine learning, including learned weights and parameters (including the
status of optimizer).
“Yi Series Models” refers to opensource models with different specifications and
capabilities named “Yi” provided by the Licensor, including Yi-6B, Yi-34B etc.
“Derivatives” refers to all modifications to Yi Series Models, work based on Yi
Series Models, or any other models created or initialized by transferring the
weights, parameters, activations, or output patterns of Yi Series Models to
other models to achieve similar performance, including but not limited to
methods that require using intermediate data representations or generating
synthetic data based on Yi Series Models to train other models.
“Licensor” refers to Beijing Lingyiwanwu Information Technology Co., Ltd.
“you” refers to an individual or legal entity that exercises the license granted
by this Agreement and/or uses the Yi Series Models for any purpose and in any
field of use.
“Third Party” refers to any individuals, legal entities or non-legal
organizations other than you.
“Distribute” refers to transmitting, copying, publishing, or otherwise sharing
the Yi Series Models with third parties, including providing the Yi Series
Models through electronic or other remote means (such as any SaaS software or
PaaS software accessed via API or web access).
“Commercial Purposes” refers to the use of the Yi Series Models, directly or
indirectly, for the operation, promotion, revenue generation, or any other
profit-making purposes for entities or individuals.
“Laws and Regulations” refers to the laws and administrative regulations of the
mainland of the People's Republic of China (for the purposes of this Agreement
only, excluding Hong Kong, Macau, and Taiwan).
“Personal Information” refers to various information related to identified or
identifiable natural persons recorded electronically or by other means,
excluding information that has been anonymized.
“Logo” refers to any trademark, service mark, trade name, domain name, website
name, or other distinctive branding marks.
2. License and License Restrictions
The Licensor hereby grants you a non-exclusive, global, non-transferable,
non-sub-licensable, revocable, and royalty-free copyright license. You must
adhere to the following license restrictions:
1) Your use of the Yi Series Models must comply with the Laws and Regulations as
well as applicable legal requirements of other countries/regions, and respect
social ethics and moral standards, including but not limited to, not using the
Yi Series Models for purposes prohibited by Laws and Regulations as well as
applicable legal requirements of other countries/regions, such as harming
national security, promoting terrorism, extremism, inciting ethnic or racial
hatred, discrimination, violence, or pornography, and spreading false harmful
information.
2) You shall not, for military or unlawful purposes or in ways not allowed by
Laws and Regulations as well as applicable legal requirements of other
countries/regions, a) use, copy or Distribute the Yi Series Models, or b) create
complete or partial Derivatives of the Yi Series Models.
3) Your use of the Yi Series Models (including using the output of the Yi Series
Models) and the creation of Derivatives must not infringe upon the legitimate
rights of any Third Party, including but not limited to the rights of personal
rights such as the right to likeness, reputation, and privacy, as well as
intellectual property rights such as copyrights, patents, trade secrets, and
other property rights.
4) You must clearly attribute the source of the Yi Series Models to the Licensor
and provide a copy of this Agreement to any Third-Party users of the Yi Series
Models and Derivatives.
5) If you modify the Yi Series Models to create Derivatives, you must clearly
indicate the substantial modifications made, and these modifications shall not
violate the license restrictions of this Agreement. You shall not enable,
assist, or in any way facilitate Third Parties to violate the license
restrictions of this Agreement.
If you plan to use the Yi Series Models and Derivatives for Commercial Purposes,
you should contact the Licensor in advance as specified in Section 7 of this
Agreement named "Updates to the Agreement and Contact Information" and obtain
written authorization from the Licensor. When you obtain authorization from the
Licensor to use the Yi Series Models and Derivatives for Commercial Purposes,
you must comply with the afore-mentioned license restrictions.
3. Intellectual Property
The ownership of the Yi Series Models and their related intellectual property
rights is solely held by the Licensor.
In any circumstance, without the prior written consent of the Licensor, you are
not allowed to use any Logo associated with the Licensor. If your use of
Licensor's Logo in violation of this Agreement causes any losses to the Licensor
or others, you will bear full legal responsibility.
4. Disclaimer and Limitation of Liability
The Yi Series Models are provided "AS IS." The Licensor does not provide any
express or implied warranties for the Yi Series Models, including but not
limited to stability, ownership, merchantability, non-infringement, or fitness
for a specific purpose of the Yi Series Models and their output results. You
assume all responsibilities for the risks and consequences arising from the use,
reproduction, distribution of the Yi Series Models, and the creation of
Derivatives.
The Licensor complies with Laws and Regulations at all stages of model training,
maintaining the legality, authenticity, accuracy, objectivity, and diversity of
data and algorithms. The Licensor is not liable for any direct, indirect,
incidental consequences, and other losses or damages related to your use,
reproduction, and distribution of the Yi Series Models, and the creation of
Derivatives under this Agreement. This includes but is not limited to:
1) The Licensor is not responsible for data security risks resulting from your
use of the Yi Series Models.
2) The Yi Series Models may contain Personal Information. When you use Yi Series
Models, you acknowledge that you are the data processing entity as defined under
the Laws and Regulations responsible for determining the processing methods and
purposes of Personal Information. You must comply with legal requirements for
processing any Personal Information that may be contained in the Yi Series
Models and assume the associated legal responsibilities, as well as the risks
and consequences of processing Personal Information.
3) The Licensor is not liable for reputation risks arising from your use of the
Yi Series Models or the output results of the Yi Series Models.
4) The Licensor is not liable for intellectual property risks associated with
your use of the Yi Series Models’ output results.
If your use, reproduction, distribution of the Yi Series Models, or the creation
of Derivatives result in losses to the Licensor, the Licensor has the right to
seek compensation from you. For any claims made by Third Parties against the
Licensor related to your use, reproduction, and distribution of the Yi Series
Models, or the creation of Derivatives, the Licensor has the right to demand
that you defend, compensate, and indemnify the Licensor and protect the Licensor
from harm.
5. Dispute Resolution
The stipulation, effectiveness, interpretation, performance, modification, and
termination of the Agreement, the use, copy and Distribute of the Yi Series
Models, and dispute resolution associated with your use, copy and distribution
shall be governed by the laws of the mainland of the People's Republic of China
(for the purposes of this agreement only, excluding Hong Kong, Macau, and
Taiwan), and the application of conflict of laws is excluded.
Any disputes arising from the use, copy or distribution of the Yi Series Models
should first be resolved through amicable negotiations. If negotiations fail,
legal proceedings should be initiated in the People's Court at the location of
the Licensor.
6. Effectiveness and Termination of the Agreement
Your use of the Yi Series Models signifies that you have read and agreed to be
bound by the terms of the Agreement. The Agreement becomes effective from the
date of your use of the Yi Series Models and will terminate from the date you
cease using the Yi Series Models. If you violate any terms or restrictions in
the Agreement, the Licensor reserves the right to terminate the Agreement.
Upon termination of the Agreement, you must immediately cease using the Yi
Series Models. Section 4, "Disclaimer and Limitation of Liability," and Section
5, "Dispute Resolution," of this Agreement remain in effect after the
termination of this Agreement.
7. Updates to the Agreement and Contact Information
The Licensor reserves the right to update the Agreement from time to time. The
latest version of the Agreement will be posted by the Licensor through
https://01.ai.
For any questions related to licensing and copyright, please contact the
Licensor at yi@01.ai.
Yi系列模型许可协议
版本: 2.0
发布日期: 2023年11月4日
1. 定义
“协议”是指本协议中定义Yi系列模型使用、复制和分发的条款和条件。
“模型”是指任何附带的基于机器学习的组件(包括检查点),包括学习的权重、参数(包括优
化器状态)。
“Yi系列模型”是指许可方开源的以Yi命名的不同规格、不同能力的模型,包括
Yi-6B、Yi-34B等。
“模型衍生品”是指对Yi系列模型的所有修改、基于Yi系列模型的工作,或通过将Yi系列模型
的权重、参数、激活或输出模式转移到其他模型而创建或初始化的任何其他模型,以使其他
模型的性能与Yi系列模型类似,包括但不限于需要使用中间数据表示的提取方法或基于Yi系
列模型生成合成数据来训练其他模型的方法。
“许可方”是指北京零一万物信息技术有限公司。
“您”是指行使本协议授予的权限和/或出于任何目的和在任何使用领域使用Yi系列模型的个
人或法人实体。
“第三方”是指您之外的任何个人、法人实体或非法人组织。
“分发”是指向第三方传输、复制、发布或以其他方式共享Yi系列模型,包括将Yi系列模型作
为通过电子或其他远程方式(例如基于 API 或 Web 访问的任何 SaaS 软件或 PaaS 软
件)。
“商业用途”是指使用Yi系列模型,直接或间接为实体或个人进行运营、推广或产生收入,或
用于任何其他盈利目的。
“法律法规”是指中华人民共和国大陆地区(仅为本协议之目的,不包括香港、澳门和台湾)
的法律及行政法规。
“个人信息”是指以电子或者其他方式记录的与已识别或者可识别的自然人有关的各种信息,
不包括匿名化处理后的信息。
“标识” 是指任何商标、服务标记、商号、域名、网站名称或其他带有显著品牌特征的标
记。
2. 许可及许可限制
许可方特此授予您非排他性、全球性、不可转让、不可再许可、可撤销、免版税的版权许
可。您必须满足如下许可限制条件:
1) 您对Yi系列模型的使用应遵守法律法规以及其他国家/地区适用的法律要求、尊重社会公
德和伦理道德。包括但不限于您不得将Yi系列模型用作危害国家安全、宣扬恐怖主义、极端
主义,宣扬民族及种族仇恨、歧视,暴力、色情,以及虚假有害信息等法律法规以及其他国
家/地区适用的法律要求禁止的目的。
2) 您不得出于军事或非法目的,或以法律法规以及其他国家/地区适用的法律要求所不允许
的方式a) 使用、复制、或分发Yi系列模型; 或b) 创建Yi系列模型的全部或部分衍生品。
3) 您对Yi系列模型的使用(包括使用Yi系列模型的输出)以及模型衍生品的创建不得侵犯
任何第三方的合法权益,包括但不限于他人肖像权、名誉权、隐私权等人格权,著作权、专
利权、商业秘密等知识产权,或其他财产权益。
4) 您必须向Yi系列模型及Yi系列模型衍生品的任何第三方使用者明确Yi系列模型的来源为
许可方并向其提供本协议的副本。
5) 若您修改Yi系列模型得到模型衍生品,您必须以显著的方式说明修改的内容,且上述修
改不得违反本协议的许可限制条件,也不能允许、协助或以其他方式使得第三方违反本协议
中的许可限制条件。
如果您计划将 Yi系列模型及模型衍生品用作商业用途,您应当事先通过第7款“协议更新及
联系方式”中的方式联系许可方进行登记并获得许可方的书面授权。若您取得许可方授权将
Yi系列模型及模型衍生品用作商业用途时,您应满足许可方上述许可限制条件。
3. 知识产权
Yi系列模型的所有权及其相关知识产权,由许可方单独所有。
在任何情况下,未经许可方事先书面同意,您不得以任何方式使用许可方的任何标识。由于
您违反本协议使用许可方的标识给许可方或他人造成损失的,由您承担全部法律责任。
4. 免责声明及责任限制
Yi系列模型按“原样”提供。许可方不对Yi系列模型提供任何明示或暗示的保证,包括但不限
于:模型及输出结果的稳定性、所有权、适销性、非侵权性、或特定用途适用性。您将对适
用、复制及分发Yi系列模型以及创建模型衍生品所产生的风险与后果承担所有责任。
许可方在模型训练的所有阶段都遵守法律法规,坚持维护数据和算法的合法、真实、准确、
客观和多样性。许可方不对您根据本协议使用、复制及分发Yi系列模型,以及创建模型衍生
品而产生或与之相关的任何直接、间接、附带的后果、以及其他损失或损害承担责任。包括
但不限于:
1) 许可方不承担您因使用Yi系列模型而导致的数据安全风险。
2) Yi系列模型中可能包含个人信息。在您使用Yi系列模型的过程中,您承认您为法律法规
定义下决定个人信息处理方式和目的的个人信息处理者。您应遵守法律法规要求处理Yi系列
模型中可能包含的个人信息,并承担相应的法律责任,以及处理个人信息的风险和后果。
3) 许可方不承担您使用Yi系列模型或模型输出结果而产生的声誉风险。
4) 许可方不承担您使用Yi系列模型的输出结果涉及的知识产权风险。
若由于您对Yi系列模型的使用、复制或分发,或者创建模型衍生品而导致许可方遭受损失,
许可方有权要求您对许可方的损失进行赔偿。对于任何第三方向许可方提出的因您使用、复
制或分发Yi系列模型或创建模型衍生品行为的相关索赔,许可方有权要求您为许可方进行辩
护、赔偿并使许可方免受损害。
5. 争议解决
协议的订立、效力、解释、履行、修改和终止,使用、复制和分发Yi系列模型以及争议解决
均适用中华人民共和国大陆地区(仅为本协议之目的,不包括香港、澳门和台湾)法律,并
排除冲突法的适用。
因使用、复制和分发Yi系列模型而发生的任何争议,各方应首先通过友好协商的方式加以解
决。协商不成时,应向许可方所在地人民法院提起诉讼。
6. 协议的生效及终止
您使用Yi系列模型即表示您已阅读并同意接受协议的约束。协议自您使用Yi系列模型之日起
生效并将在您停止使用Yi系列模型之日起终止。若您违反协议中的任何条款或限制,许可方
有权终止协议。
若协议终止,您需立即停止使用Yi系列模型。本协议第4条“免责声明及责任限制”及第5条
“争议解决”在协议终止后仍有效。
7. 协议更新及联系方式
许可方有权对协议进行不时更新。许可方将通过https://01.ai公布协议最新版本。有关许
可和版权的任何问题,请通过yi@01.ai 与许可方联系。

427
README.md Normal file
View File

@@ -0,0 +1,427 @@
---
base_model: larryvrh/Yi-34B-200K-Llamafied
inference: false
language:
- zh
- en
license: other
license_link: LICENSE
license_name: yi-license
model_creator: larryvrh
model_name: Yi 34B 200K Llamafied
model_type: yi
prompt_template: '{prompt}
'
quantized_by: TheBloke
---
<!-- markdownlint-disable MD041 -->
<!-- header start -->
<!-- 200823 -->
<div style="width: auto; margin-left: auto; margin-right: auto">
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
</div>
<div style="display: flex; justify-content: space-between; width: 100%;">
<div style="display: flex; flex-direction: column; align-items: flex-start;">
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
</div>
<div style="display: flex; flex-direction: column; align-items: flex-end;">
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
</div>
</div>
<div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
<!-- header end -->
# Yi 34B 200K Llamafied - GPTQ
- Model creator: [larryvrh](https://huggingface.co/larryvrh)
- Original model: [Yi 34B 200K Llamafied](https://huggingface.co/larryvrh/Yi-34B-200K-Llamafied)
<!-- description start -->
## Description
This repo contains GPTQ model files for [larryvrh's Yi 34B 200K Llamafied](https://huggingface.co/larryvrh/Yi-34B-200K-Llamafied).
Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
<!-- description end -->
<!-- repositories-available start -->
## Repositories available
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-AWQ)
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-GPTQ)
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-GGUF)
* [larryvrh's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/larryvrh/Yi-34B-200K-Llamafied)
<!-- repositories-available end -->
<!-- prompt-template start -->
## Prompt template: None
```
{prompt}
```
<!-- prompt-template end -->
<!-- README_GPTQ.md-compatible clients start -->
## Known compatible clients / servers
These GPTQ models are known to work in the following inference servers/webuis.
- [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
- [KoboldAI United](https://github.com/henk717/koboldai)
- [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
This may not be a complete list; if you know of others, please let me know!
<!-- README_GPTQ.md-compatible clients end -->
<!-- README_GPTQ.md-provided-files start -->
## Provided files, and GPTQ parameters
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
<details>
<summary>Explanation of GPTQ parameters</summary>
- Bits: The bit size of the quantised model.
- GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
- Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
- Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
- GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
- Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
- ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
</details>
| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
| ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
| [main](https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-GPTQ/tree/main) | 4 | None | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-raw-v1) | 8192 | 18.60 GB | Yes | 4-bit, with Act Order. No group size, to lower VRAM requirements. |
| [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-GPTQ/tree/gptq-4bit-128g-actorder_True) | 4 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-raw-v1) | 8192 | 19.25 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
| [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-raw-v1) | 8192 | 21.21 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
| [gptq-3bit-128g-actorder_True](https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-GPTQ/tree/gptq-3bit-128g-actorder_True) | 3 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-raw-v1) | 8192 | 15.03 GB | No | 3-bit, with group size 128g and act-order. Higher quality than 128g-False. |
| [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-raw-v1) | 8192 | 35.34 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
| [gptq-3bit-32g-actorder_True](https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-GPTQ/tree/gptq-3bit-32g-actorder_True) | 3 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-raw-v1) | 8192 | 16.90 GB | No | 3-bit, with group size 64g and act-order. Highest quality 3-bit option. |
| [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-raw-v1) | 8192 | 36.11 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
<!-- README_GPTQ.md-provided-files end -->
<!-- README_GPTQ.md-download-from-branches start -->
## How to download, including from branches
### In text-generation-webui
To download from the `main` branch, enter `TheBloke/Yi-34B-200K-Llamafied-GPTQ` in the "Download model" box.
To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Yi-34B-200K-Llamafied-GPTQ:gptq-4bit-128g-actorder_True`
### From the command line
I recommend using the `huggingface-hub` Python library:
```shell
pip3 install huggingface-hub
```
To download the `main` branch to a folder called `Yi-34B-200K-Llamafied-GPTQ`:
```shell
mkdir Yi-34B-200K-Llamafied-GPTQ
huggingface-cli download TheBloke/Yi-34B-200K-Llamafied-GPTQ --local-dir Yi-34B-200K-Llamafied-GPTQ --local-dir-use-symlinks False
```
To download from a different branch, add the `--revision` parameter:
```shell
mkdir Yi-34B-200K-Llamafied-GPTQ
huggingface-cli download TheBloke/Yi-34B-200K-Llamafied-GPTQ --revision gptq-4bit-128g-actorder_True --local-dir Yi-34B-200K-Llamafied-GPTQ --local-dir-use-symlinks False
```
<details>
<summary>More advanced huggingface-cli download usage</summary>
If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Hugging Face cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
```shell
pip3 install hf_transfer
```
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
```shell
mkdir Yi-34B-200K-Llamafied-GPTQ
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Yi-34B-200K-Llamafied-GPTQ --local-dir Yi-34B-200K-Llamafied-GPTQ --local-dir-use-symlinks False
```
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
</details>
### With `git` (**not** recommended)
To clone a specific branch with `git`, use a command like this:
```shell
git clone --single-branch --branch gptq-4bit-128g-actorder_True https://huggingface.co/TheBloke/Yi-34B-200K-Llamafied-GPTQ
```
Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
<!-- README_GPTQ.md-download-from-branches end -->
<!-- README_GPTQ.md-text-generation-webui start -->
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
1. Click the **Model tab**.
2. Under **Download custom model or LoRA**, enter `TheBloke/Yi-34B-200K-Llamafied-GPTQ`.
- To download from a specific branch, enter for example `TheBloke/Yi-34B-200K-Llamafied-GPTQ:gptq-4bit-128g-actorder_True`
- see Provided Files above for the list of branches for each option.
3. Click **Download**.
4. The model will start downloading. Once it's finished it will say "Done".
5. In the top left, click the refresh icon next to **Model**.
6. In the **Model** dropdown, choose the model you just downloaded: `Yi-34B-200K-Llamafied-GPTQ`
7. The model will automatically load, and is now ready for use!
8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
- Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
<!-- README_GPTQ.md-text-generation-webui end -->
<!-- README_GPTQ.md-use-from-tgi start -->
## Serving this model from Text Generation Inference (TGI)
It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
Example Docker parameters:
```shell
--model-id TheBloke/Yi-34B-200K-Llamafied-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
```
Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
```shell
pip3 install huggingface-hub
```
```python
from huggingface_hub import InferenceClient
endpoint_url = "https://your-endpoint-url-here"
prompt = "Tell me about AI"
prompt_template=f'''{prompt}
'''
client = InferenceClient(endpoint_url)
response = client.text_generation(prompt,
max_new_tokens=128,
do_sample=True,
temperature=0.7,
top_p=0.95,
top_k=40,
repetition_penalty=1.1)
print(f"Model output: {response}")
```
<!-- README_GPTQ.md-use-from-tgi end -->
<!-- README_GPTQ.md-use-from-python start -->
## How to use this GPTQ model from Python code
### Install the necessary packages
Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
```shell
pip3 install transformers optimum
pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
```
If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
```shell
pip3 uninstall -y auto-gptq
git clone https://github.com/PanQiWei/AutoGPTQ
cd AutoGPTQ
git checkout v0.4.2
pip3 install .
```
### You can then use the following code
```python
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
model_name_or_path = "TheBloke/Yi-34B-200K-Llamafied-GPTQ"
# To use a different branch, change revision
# For example: revision="gptq-4bit-128g-actorder_True"
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
device_map="auto",
trust_remote_code=True,
revision="main")
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
prompt = "Tell me about AI"
prompt_template=f'''{prompt}
'''
print("\n\n*** Generate:")
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
print(tokenizer.decode(output[0]))
# Inference can also be done using transformers' pipeline
print("*** Pipeline:")
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
max_new_tokens=512,
do_sample=True,
temperature=0.7,
top_p=0.95,
top_k=40,
repetition_penalty=1.1
)
print(pipe(prompt_template)[0]['generated_text'])
```
<!-- README_GPTQ.md-use-from-python end -->
<!-- README_GPTQ.md-compatibility start -->
## Compatibility
The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.
[ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
For a list of clients/servers, please see "Known compatible clients / servers", above.
<!-- README_GPTQ.md-compatibility end -->
<!-- footer start -->
<!-- 200823 -->
## Discord
For further support, and discussions on these models and AI in general, join us at:
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
## Thanks, and how to contribute
Thanks to the [chirper.ai](https://chirper.ai) team!
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
* Patreon: https://patreon.com/TheBlokeAI
* Ko-Fi: https://ko-fi.com/TheBlokeAI
**Special thanks to**: Aemon Algiz.
**Patreon special mentions**: Brandon Frisco, LangChain4j, Spiking Neurons AB, transmissions 11, Joseph William Delisle, Nitin Borwankar, Willem Michiel, Michael Dempsey, vamX, Jeffrey Morgan, zynix, jjj, Omer Bin Jawed, Sean Connelly, jinyuan sun, Jeromy Smith, Shadi, Pawan Osman, Chadd, Elijah Stavena, Illia Dulskyi, Sebastain Graf, Stephen Murray, terasurfer, Edmond Seymore, Celu Ramasamy, Mandus, Alex, biorpg, Ajan Kanaga, Clay Pascal, Raven Klaugh, 阿明, K, ya boyyy, usrbinkat, Alicia Loh, John Villwock, ReadyPlayerEmma, Chris Smitley, Cap'n Zoog, fincy, GodLy, S_X, sidney chen, Cory Kujawski, OG, Mano Prime, AzureBlack, Pieter, Kalila, Spencer Kim, Tom X Nguyen, Stanislav Ovsiannikov, Michael Levine, Andrey, Trailburnt, Vadim, Enrico Ros, Talal Aujan, Brandon Phillips, Jack West, Eugene Pentland, Michael Davis, Will Dee, webtim, Jonathan Leane, Alps Aficionado, Rooh Singh, Tiffany J. Kim, theTransient, Luke @flexchar, Elle, Caitlyn Gatomon, Ari Malik, subjectnull, Johann-Peter Hartmann, Trenton Dambrowitz, Imad Khwaja, Asp the Wyvern, Emad Mostaque, Rainer Wilmers, Alexandros Triantafyllidis, Nicholas, Pedro Madruga, SuperWojo, Harry Royden McLaughlin, James Bentley, Olakabola, David Ziegler, Ai Maven, Jeff Scroggin, Nikolai Manek, Deo Leter, Matthew Berman, Fen Risland, Ken Nordquist, Manuel Alberto Morcote, Luke Pendergrass, TL, Fred von Graf, Randy H, Dan Guido, NimbleBox.ai, Vitor Caleffi, Gabriel Tamborski, knownsqashed, Lone Striker, Erik Bjäreholt, John Detwiler, Leonard Tan, Iucharbius
Thank you to all my generous patrons and donaters!
And thank you again to a16z for their generous grant.
<!-- footer end -->
# Original model card: larryvrh's Yi 34B 200K Llamafied
Llamafied version of 01-ai's [Yi-34B-200k](https://huggingface.co/01-ai/Yi-34B-200K) for ease of use.
## Model Performance
| Model | MMLU | CMMLU | C-Eval | GAOKAO | BBH | Common-sense Reasoning | Reading Comprehension | Math & Code |
| :------------ | :------: | :------: | :------: | :------: | :------: | :--------------------: | :-------------------: | :---------: |
| | 5-shot | 5-shot | 5-shot | 0-shot | 3-shot@1 | - | - | - |
| LLaMA2-34B | 62.6 | - | - | - | 44.1 | 69.9 | 68.0 | 26.0 |
| LLaMA2-70B | 68.9 | 53.3 | - | 49.8 | 51.2 | 71.9 | 69.4 | 36.8 |
| Baichuan2-13B | 59.2 | 62.0 | 58.1 | 54.3 | 48.8 | 64.3 | 62.4 | 23.0 |
| Qwen-14B | 66.3 | 71.0 | 72.1 | 62.5 | 53.4 | 73.3 | 72.5 | **39.8** |
| Skywork-13B | 62.1 | 61.8 | 60.6 | 68.1 | 41.7 | 72.4 | 61.4 | 24.9 |
| InternLM-20B | 62.1 | 59.0 | 58.8 | 45.5 | 52.5 | 78.3 | - | 30.4 |
| Aquila-34B | 67.8 | 71.4 | 63.1 | - | - | - | - | - |
| Falcon-180B | 70.4 | 58.0 | 57.8 | 59.0 | 54.0 | 77.3 | 68.8 | 34.0 |
| Yi-6B | 63.2 | 75.5 | 72.0 | 72.2 | 42.8 | 72.3 | 68.7 | 19.8 |
| Yi-6B-200K | 64.0 | 75.3 | 73.5 | 73.9 | 42.0 | 72.0 | 69.1 | 19.0 |
| **Yi-34B** | **76.3** | **83.7** | 81.4 | 82.8 | **54.3** | **80.1** | 76.4 | 37.1 |
| Yi-34B-200K | 76.1 | 83.6 | **81.9** | **83.4** | 52.7 | 79.7 | **76.6** | 36.3 |
While benchmarking open-source models, we have observed a disparity between the
results generated by our pipeline and those reported in public sources (e.g.
OpenCompass). Upon conducting a more in-depth investigation of this difference,
we have discovered that various models may employ different prompts,
post-processing strategies, and sampling techniques, potentially resulting in
significant variations in the outcomes. Our prompt and post-processing strategy
remains consistent with the original benchmark, and greedy decoding is employed
during evaluation without any post-processing for the generated content. For
scores that were not reported by the original authors (including scores reported
with different settings), we try to get results with our pipeline.
To evaluate the model's capability extensively, we adopted the methodology
outlined in Llama2. Specifically, we included PIQA, SIQA, HellaSwag, WinoGrande,
ARC, OBQA, and CSQA to assess common sense reasoning. SquAD, QuAC, and BoolQ
were incorporated to evaluate reading comprehension. CSQA was exclusively tested
using a 7-shot setup, while all other tests were conducted with a 0-shot
configuration. Additionally, we introduced GSM8K (8-shot@1), MATH (4-shot@1),
HumanEval (0-shot@1), and MBPP (3-shot@1) under the category "Math & Code". Due
to technical constraints, we did not test Falcon-180 on QuAC and OBQA; the score
is derived by averaging the scores on the remaining tasks. Since the scores for
these two tasks are generally lower than the average, we believe that
Falcon-180B's performance was not underestimated.
## Usage
Please visit our [github repository](https://github.com/01-ai/Yi) for general
guidance on how to use this model.
## Disclaimer
Although we use data compliance checking algorithms during the training process
to ensure the compliance of the trained model to the best of our ability, due to
the complexity of the data and the diversity of language model usage scenarios,
we cannot guarantee that the model will generate correct and reasonable output
in all scenarios. Please be aware that there is still a risk of the model
producing problematic outputs. We will not be responsible for any risks and
issues resulting from misuse, misguidance, illegal usage, and related
misinformation, as well as any associated data security concerns.
## License
The Yi series models are fully open for academic research and free commercial
usage with permission via applications. All usage must adhere to the [Model
License Agreement 2.0](https://huggingface.co/01-ai/Yi-34B-200K/blob/main/LICENSE). To
apply for the official commercial license, please contact us
([yi@01.ai](mailto:yi@01.ai)).

39
config.json Normal file
View File

@@ -0,0 +1,39 @@
{
"_name_or_path": "/workspace/process/larryvrh_yi-34b-200k-llamafied/source",
"architectures": [
"LlamaForCausalLM"
],
"attention_bias": false,
"bos_token_id": 1,
"eos_token_id": 2,
"hidden_act": "silu",
"hidden_size": 7168,
"initializer_range": 0.02,
"intermediate_size": 20480,
"max_position_embeddings": 200000,
"model_type": "llama",
"num_attention_heads": 56,
"num_hidden_layers": 60,
"num_key_value_heads": 8,
"pad_token_id": 0,
"pretraining_tp": 1,
"rms_norm_eps": 1e-05,
"rope_scaling": null,
"rope_theta": 5000000.0,
"tie_word_embeddings": false,
"torch_dtype": "bfloat16",
"transformers_version": "4.35.0",
"use_cache": true,
"vocab_size": 64000,
"quantization_config": {
"bits": 4,
"group_size": -1,
"damp_percent": 0.1,
"desc_act": true,
"sym": true,
"true_sequential": true,
"model_name_or_path": null,
"model_file_base_name": "model",
"quant_method": "gptq"
}
}

1
configuration.json Normal file
View File

@@ -0,0 +1 @@
{"framework": "pytorch", "task": "text-generation", "allow_remote": true}

7
generation_config.json Normal file
View File

@@ -0,0 +1,7 @@
{
"_from_model_config": true,
"bos_token_id": 1,
"eos_token_id": 2,
"pad_token_id": 0,
"transformers_version": "4.35.0"
}

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2340e659c11d785a72c06527bccc6505d2f430d1806816afbd584a4a4b8134e1
size 18604922424

10
quantize_config.json Normal file
View File

@@ -0,0 +1,10 @@
{
"bits": 4,
"group_size": -1,
"damp_percent": 0.1,
"desc_act": true,
"sym": true,
"true_sequential": true,
"model_name_or_path": null,
"model_file_base_name": "model"
}

30
special_tokens_map.json Normal file
View File

@@ -0,0 +1,30 @@
{
"bos_token": {
"content": "<|startoftext|>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false
},
"eos_token": {
"content": "<|endoftext|>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false
},
"pad_token": {
"content": "<unk>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false
},
"unk_token": {
"content": "<unk>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false
}
}

255
tokenization_yi.py Normal file
View File

@@ -0,0 +1,255 @@
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from transformers.tokenization_utils import AddedToken, PreTrainedTokenizer
from transformers.utils import logging
logger = logging.get_logger(__name__)
VOCAB_FILES_NAMES = {"vocab_file": "tokenizer.model"}
PRETRAINED_VOCAB_FILES_MAP = {
"vocab_file": {},
"tokenizer_file": {},
}
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {}
class YiTokenizer(PreTrainedTokenizer):
"""
Construct a Yi tokenizer. Based on byte-level Byte-Pair-Encoding.
Args:
vocab_file (`str`):
Path to the vocabulary file.
"""
vocab_files_names = VOCAB_FILES_NAMES
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
model_input_names = ["input_ids", "attention_mask"]
def __init__(
self,
vocab_file,
unk_token="<unk>",
bos_token="<|startoftext|>",
eos_token="<|endoftext|>",
pad_token="<unk>",
sp_model_kwargs: Optional[Dict[str, Any]] = None,
add_bos_token=True,
add_eos_token=False,
clean_up_tokenization_spaces=False,
**kwargs,
):
self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
bos_token = (
AddedToken(bos_token, lstrip=False, rstrip=False)
if isinstance(bos_token, str)
else bos_token
)
eos_token = (
AddedToken(eos_token, lstrip=False, rstrip=False)
if isinstance(eos_token, str)
else eos_token
)
unk_token = (
AddedToken(unk_token, lstrip=False, rstrip=False)
if isinstance(unk_token, str)
else unk_token
)
pad_token = (
AddedToken(pad_token, lstrip=False, rstrip=False)
if isinstance(pad_token, str)
else pad_token
)
self.vocab_file = vocab_file
self.add_bos_token = add_bos_token
self.add_eos_token = add_eos_token
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
self.sp_model.Load(vocab_file)
super().__init__(
bos_token=bos_token,
eos_token=eos_token,
unk_token=unk_token,
pad_token=pad_token,
add_bos_token=add_bos_token,
add_eos_token=add_eos_token,
sp_model_kwargs=self.sp_model_kwargs,
clean_up_tokenization_spaces=clean_up_tokenization_spaces,
**kwargs,
)
def __getstate__(self):
state = self.__dict__.copy()
state["sp_model"] = None
return state
def __setstate__(self, d):
self.__dict__ = d
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
self.sp_model.Load(self.vocab_file)
@property
def vocab_size(self):
"""Returns vocab size"""
return self.sp_model.get_piece_size()
def get_vocab(self):
"""Returns vocab as a dict"""
vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
vocab.update(self.added_tokens_encoder)
return vocab
def _tokenize(self, text):
"""Returns a tokenized string."""
return self.sp_model.encode(text, out_type=str)
def _convert_token_to_id(self, token):
"""Converts a token (str) in an id using the vocab."""
return self.sp_model.piece_to_id(token)
def _convert_id_to_token(self, index):
"""Converts an index (integer) in a token (str) using the vocab."""
token = self.sp_model.IdToPiece(index)
return token
def convert_tokens_to_string(self, tokens):
"""Converts a sequence of tokens (string) in a single string."""
current_sub_tokens = []
out_string = ""
prev_is_special = False
for i, token in enumerate(tokens):
# make sure that special tokens are not decoded using sentencepiece model
if token in self.all_special_tokens:
if not prev_is_special and i != 0:
out_string += " "
out_string += self.sp_model.decode(current_sub_tokens) + token
prev_is_special = True
current_sub_tokens = []
else:
current_sub_tokens.append(token)
prev_is_special = False
out_string += self.sp_model.decode(current_sub_tokens)
return out_string
def save_vocabulary(
self, save_directory, filename_prefix: Optional[str] = None
) -> Tuple[str]:
"""
Save the vocabulary and special tokens file to a directory.
Args:
save_directory (`str`):
The directory in which to save the vocabulary.
Returns:
`Tuple(str)`: Paths to the files saved.
"""
if not os.path.isdir(save_directory):
logger.error(f"Vocabulary path ({save_directory}) should be a directory")
return
out_vocab_file = os.path.join(
save_directory,
(filename_prefix + "-" if filename_prefix else "")
+ VOCAB_FILES_NAMES["vocab_file"],
)
if os.path.abspath(self.vocab_file) != os.path.abspath(
out_vocab_file
) and os.path.isfile(self.vocab_file):
copyfile(self.vocab_file, out_vocab_file)
elif not os.path.isfile(self.vocab_file):
with open(out_vocab_file, "wb") as fi:
content_spiece_model = self.sp_model.serialized_model_proto()
fi.write(content_spiece_model)
return (out_vocab_file,)
def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
bos_token_id = [self.bos_token_id] if self.add_bos_token else []
eos_token_id = [self.eos_token_id] if self.add_eos_token else []
output = bos_token_id + token_ids_0 + eos_token_id
if token_ids_1 is not None:
output = output + bos_token_id + token_ids_1 + eos_token_id
return output
def get_special_tokens_mask(
self,
token_ids_0: List[int],
token_ids_1: Optional[List[int]] = None,
already_has_special_tokens: bool = False,
) -> List[int]:
"""
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `prepare_for_model` method.
Args:
token_ids_0 (`List[int]`):
List of IDs.
token_ids_1 (`List[int]`, *optional*):
Optional second list of IDs for sequence pairs.
already_has_special_tokens (`bool`, *optional*, defaults to `False`):
Whether or not the token list is already formatted with special tokens for the model.
Returns:
`List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
"""
if already_has_special_tokens:
return super().get_special_tokens_mask(
token_ids_0=token_ids_0,
token_ids_1=token_ids_1,
already_has_special_tokens=True,
)
bos_token_id = [1] if self.add_bos_token else []
eos_token_id = [1] if self.add_eos_token else []
if token_ids_1 is None:
return bos_token_id + ([0] * len(token_ids_0)) + eos_token_id
return (
bos_token_id
+ ([0] * len(token_ids_0))
+ eos_token_id
+ bos_token_id
+ ([0] * len(token_ids_1))
+ eos_token_id
)
def create_token_type_ids_from_sequences(
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
) -> List[int]:
"""
Creates a mask from the two sequences passed to be used in a sequence-pair classification task. An ALBERT
sequence pair mask has the following format:
```
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
| first sequence | second sequence |
```
if token_ids_1 is None, only returns the first portion of the mask (0s).
Args:
token_ids_0 (`List[int]`):
List of ids.
token_ids_1 (`List[int]`, *optional*):
Optional second list of IDs for sequence pairs.
Returns:
`List[int]`: List of [token type IDs](../glossary#token-type-ids) according to the given sequence(s).
"""
bos_token_id = [self.bos_token_id] if self.add_bos_token else []
eos_token_id = [self.eos_token_id] if self.add_eos_token else []
output = [0] * len(bos_token_id + token_ids_0 + eos_token_id)
if token_ids_1 is not None:
output += [1] * len(bos_token_id + token_ids_1 + eos_token_id)
return output

3
tokenizer.model Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:386c49cf943d71aa110361135338c50e38beeff0a66593480421f37b319e1a39
size 1033105

44
tokenizer_config.json Normal file
View File

@@ -0,0 +1,44 @@
{
"add_bos_token": false,
"add_eos_token": false,
"added_tokens_decoder": {
"0": {
"content": "<unk>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false,
"special": true
},
"1": {
"content": "<|startoftext|>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false,
"special": true
},
"2": {
"content": "<|endoftext|>",
"lstrip": false,
"normalized": true,
"rstrip": false,
"single_word": false,
"special": true
}
},
"auto_map": {
"AutoTokenizer": [
"tokenization_yi.YiTokenizer",
null
]
},
"bos_token": "<|startoftext|>",
"clean_up_tokenization_spaces": false,
"eos_token": "<|endoftext|>",
"model_max_length": 200000,
"pad_token": "<unk>",
"sp_model_kwargs": {},
"tokenizer_class": "YiTokenizer",
"unk_token": "<unk>"
}