🚀 GoLLIE 7B
GoLLIEは、アノテーションガイドラインに沿って訓練された大規模言語モデルです。ゼロショット情報抽出タスクで従来のアプローチを上回り、ユーザーがオンザフライで定義したアノテーションスキーマで推論を行うことができます。
🚀 クイックスタート
GoLLIEを始めるには、🚀 Example Jupyter Notebooksを参照してください。
モデルを読み込む最良の方法は、カスタムのload_model
関数を使用することです。ただし、AutoModelForCausalLM
クラスを使用して読み込むこともできます。
⚠️ 重要提示
当社のフラッシュアテンションの実装は、Huggingfaceのアテンションの実装と比較してわずかな数値的な違いがあります。trust_remote_code=True
フラグを使用する必要があります。そうしないと、結果が劣化します。フラッシュアテンションには利用可能なCUDA GPUが必要です。GOLLIEの事前学習モデルをCPUで実行することはサポートされていません。将来的なリリースでこの問題を解決する予定です。まず、フラッシュアテンション2をインストールしてください。
pip install flash-attn --no-build-isolation
pip install git+https://github.com/HazyResearch/flash-attention.git#subdirectory=csrc/rotary
その後、以下のようにモデルを読み込むことができます。
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("HiTZ/GoLLIE-7B")
model = AutoModelForCausalLM.from_pretrained("HiTZ/GoLLIE-7B", trust_remote_code=True, torch_dtype=torch.bfloat16)
model.to("cuda")
🚀 Example Jupyter Notebooksを読んで、ガイドラインの定義、モデル入力の生成、出力の解析方法を学びましょう!
✨ 主な機能
- ゼロショット情報抽出タスクで優れた性能を発揮します。
- アノテーションガイドラインに沿って推論を行うことができます。
- オンザフライで定義したアノテーションスキーマで推論を行うことができます。
📦 インストール
まず、フラッシュアテンション2をインストールしてください。
pip install flash-attn --no-build-isolation
pip install git+https://github.com/HazyResearch/flash-attention.git#subdirectory=csrc/rotary
💻 使用例
基本的な使用法
ラベルはPythonクラスとして表され、ガイドラインや指示はドキュメント文字列として導入されます。モデルはresult = [
行の後に生成を開始します。
@dataclass
class Launcher(Template):
"""Refers to a vehicle designed primarily to transport payloads from the Earth's
surface to space. Launchers can carry various payloads, including satellites,
crewed spacecraft, and cargo, into various orbits or even beyond Earth's orbit.
They are usually multi-stage vehicles that use rocket engines for propulsion."""
mention: str
"""
The name of the launcher vehicle.
Such as: "Sturn V", "Atlas V", "Soyuz", "Ariane 5"
"""
space_company: str
crew: List[str]
@dataclass
class Mission(Template):
"""Any planned or accomplished journey beyond Earth's atmosphere with specific objectives,
either crewed or uncrewed. It includes missions to satellites, the International
Space Station (ISS), other celestial bodies, and deep space."""
mention: str
"""
The name of the mission.
Such as: "Apollo 11", "Artemis", "Mercury"
"""
date: str
departure: str
destination: str
text = (
"The Ares 3 mission to Mars is scheduled for 2032. The Starship rocket build by SpaceX will take off from Boca Chica,"
"carrying the astronauts Max Rutherford, Elena Soto, and Jake Martinez."
)
result = [
Mission(mention='Ares 3', date='2032', departure='Boca Chica', destination='Mars'),
Launcher(mention='Starship', space_company='SpaceX', crew=['Max Rutherford', 'Elena Soto', 'Jake Martinez'])
]
📚 ドキュメント
モデルの詳細
Property |
Details |
Model Type |
テキスト生成 |
Language(s) (NLP) |
英語 |
License |
ベースモデルとマージモデルはLLaMA2ライセンス。事前学習されたLoRAアダプターはApache 2.0ライセンス |
Finetuned from model |
CODE-LLaMA2 |
訓練データ
これはGoLLIEの訓練と評価に使用されるタスクのリストです。ただし、🚀 Create Custom Task notebookで示されているように、GoLLIEは幅広い未知のタスクを実行できます。詳細については、📖Paperを読んでください。
評価
環境への影響
Model |
Hardware |
FLOPs |
Time (h) |
CO2eq (kg) |
GoLLIE 7B |
1xA100 |
11.9e18 |
44.5 |
1.57 |
GoLLIE 13B |
1xA100 |
22.7e18 |
79.5 |
2.80 |
GoLLIE 34B |
2xA100 |
55.8e18 |
94.6 |
6.67 |
🔧 技術詳細
GoLLIEは、アノテーションガイドラインに沿って訓練された大規模言語モデルです。ゼロショット情報抽出タスクで従来のアプローチを上回り、ユーザーがオンザフライで定義したアノテーションスキーマで推論を行うことができます。
📄 ライセンス
ベースモデルとマージモデルはLLaMA2ライセンス。事前学習されたLoRAアダプターはApache 2.0ライセンス
📖 引用
@misc{sainz2023gollie,
title={GoLLIE: Annotation Guidelines improve Zero-Shot Information-Extraction},
author={Oscar Sainz and Iker García-Ferrero and Rodrigo Agerri and Oier Lopez de Lacalle and German Rigau and Eneko Agirre},
year={2023},
eprint={2310.03668},
archivePrefix={arXiv},
primaryClass={cs.CL}
}