🚀 gpt-neo-1.3B-emailgen
該模型是基於 EleutherAI/gpt-neo-1.3B 在 postbot/multi-emails-100k 數據集上進行微調的版本。它在評估集上取得了以下成果:
🚀 快速開始
此模型主要用於文本生成,特別是電子郵件生成。你可以通過以下方式使用它:
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("postbot/gpt-neo-1.3B-emailgen")
tokenizer = AutoTokenizer.from_pretrained("postbot/gpt-neo-1.3B-emailgen")
input_text = "Good Morning Professor Beans, Hope you are doing well. I just wanted to reach out and ask if differential calculus will be on the exam"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
output = model.generate(input_ids, **parameters)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
輸入參數詳情
參數 |
詳情 |
min_length |
生成文本的最小長度,設置為 32 |
max_length |
生成文本的最大長度,設置為 128 |
no_repeat_ngram_size |
避免重複的 n-gram 大小,設置為 2 |
do_sample |
是否進行採樣,設置為 True |
temperature |
採樣溫度,設置為 0.4 |
top_k |
採樣時考慮的前 k 個詞,設置為 30 |
top_p |
採樣時考慮的累積概率,設置為 0.9 |
repetition_penalty |
重複懲罰係數,設置為 3.5 |
length_penalty |
長度懲罰係數,設置為 0.9 |
✨ 主要特性
- 文本生成能力:能夠根據輸入的文本生成相關的電子郵件內容。
- 多場景適用:可用於多種電子郵件場景,如給教授發郵件、發送時事通訊、詢問辦公時間等。
📦 安裝指南
暫未提供具體安裝步驟,你可以參考 Hugging Face 的相關文檔來安裝所需的庫,如 transformers
、torch
等。
💻 使用示例
基礎用法
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("postbot/gpt-neo-1.3B-emailgen")
tokenizer = AutoTokenizer.from_pretrained("postbot/gpt-neo-1.3B-emailgen")
input_text = "Good Morning Professor Beans, Hope you are doing well. I just wanted to reach out and ask if differential calculus will be on the exam"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
output = model.generate(input_ids, min_length=32, max_length=128, no_repeat_ngram_size=2, do_sample=True, temperature=0.4, top_k=30, top_p=0.9, repetition_penalty=3.5, length_penalty=0.9)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
高級用法
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("postbot/gpt-neo-1.3B-emailgen")
tokenizer = AutoTokenizer.from_pretrained("postbot/gpt-neo-1.3B-emailgen")
scenarios = [
"Hey <NAME>, Thank you for signing up for my weekly newsletter. Before we get started, you'll have to confirm your email address.",
"Hi <NAME>, I hope this email finds you well. I wanted to reach out and ask about office hours"
]
for scenario in scenarios:
input_ids = tokenizer(scenario, return_tensors="pt").input_ids
output = model.generate(input_ids, min_length=32, max_length=128, no_repeat_ngram_size=2, do_sample=True, temperature=0.4, top_k=30, top_p=0.9, repetition_penalty=3.5, length_penalty=0.9)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(f"Scenario: {scenario}\nGenerated Text: {generated_text}\n")
📚 詳細文檔
模型描述
更多詳細信息待補充。
預期用途與限制
更多詳細信息待補充。
訓練和評估數據
更多詳細信息待補充。
🔧 技術細節
訓練過程
訓練超參數
訓練過程中使用了以下超參數:
- 學習率(learning_rate):0.0001
- 訓練批次大小(train_batch_size):4
- 評估批次大小(eval_batch_size):4
- 隨機種子(seed):42
- 分佈式類型(distributed_type):多 GPU
- 梯度累積步數(gradient_accumulation_steps):32
- 總訓練批次大小(total_train_batch_size):128
- 優化器(optimizer):Adam,β=(0.9, 0.999),ε=1e - 08
- 學習率調度器類型(lr_scheduler_type):餘弦
- 學習率調度器熱身比例(lr_scheduler_warmup_ratio):0.02
- 訓練輪數(num_epochs):2
訓練結果
訓練損失 |
輪數 |
步數 |
驗證損失 |
1.8669 |
1.0 |
789 |
1.7866 |
1.4049 |
2.0 |
1578 |
1.6930 |
框架版本
- Transformers 4.22.2
- Pytorch 1.10.0+cu113
- Tokenizers 0.12.1
📄 許可證
該模型使用 Apache - 2.0 許可證。
📊 評估結果
詳細結果可查看 此處
指標 |
值 |
平均值(Avg.) |
33.47 |
AI2 推理挑戰(25 - 樣本) |
29.95 |
HellaSwag(10 - 樣本) |
47.95 |
MMLU(5 - 樣本) |
24.11 |
TruthfulQA(0 - 樣本) |
42.55 |
Winogrande(5 - 樣本) |
56.27 |
GSM8k(5 - 樣本) |
0.00 |