Jamba Hercules
Jamba-Hercules是基於ai21labs/Jamba-v0.1微調的大語言模型,使用Locutusque/hercules-v4.0數據集進行訓練,專注於文本生成任務。
下載量 24
發布時間 : 3/31/2024
模型概述
該模型是一個經過微調的大語言模型,主要用於生成高質量的文本內容,能夠理解和生成複雜的自然語言響應。
模型特點
高效微調
使用Locutusque/hercules-v4.0數據集的前1萬條示例進行微調,優化了模型性能。
低資源推理
支持4位量化推理,降低硬件需求,可在消費級GPU上運行。
對話優化
特別優化了對話生成能力,能夠生成連貫、有邏輯的對話響應。
模型能力
文本生成
對話系統
創意寫作
使用案例
對話系統
AI助手
可作為智能對話助手使用,回答用戶問題並提供幫助。
生成自然、連貫的對話響應
創意寫作
科幻故事生成
生成富有想象力的科幻故事和場景描述。
如示例中展示的'太空樹'創意故事
🚀 Jamba-Hercules
Jamba-Hercules是一個文本生成模型,基於特定數據集訓練,能處理文本生成任務,可用於生成富有想象力的文本內容,如示例中樹成為太空生物的過程描述。
🚀 快速開始
模型信息
屬性 | 詳情 |
---|---|
模型類型 | 文本生成模型 |
基礎模型 | ai21labs/Jamba-v0.1 |
訓練數據集 | Locutusque/hercules-v4.0 |
許可證 | Apache-2.0 |
數據集使用說明
使用的數據集為 Locutusque/hercules-v4.0,使用了前 10k 個示例。
💻 使用示例
基礎用法
# 此代碼會自動將 "<|startoftext|>" 特殊標記添加到任何輸入中。在推理時,必須將此標記添加到所有輸入中,因為初步測試表明,不添加該標記會導致輸出錯誤。
!pip install -qqq transformers>=4.39.0 mamba-ssm causal-conv1d>=1.2.0 accelerate bitsandbytes --progress-bar off
!pip install flash-attn --no-build-isolation
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
double_quant_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.float16
)
model = AutoModelForCausalLM.from_pretrained(
"Severian/Jamba-Hercules",
device_map="auto",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
attn_implementation="flash_attention_2",
quantization_config=double_quant_config,
)
tokenizer = AutoTokenizer.from_pretrained("Severian/Jamba-Hercules")
input_text = """<|im_start|>system
You are a helpful AI assistant.
<|im_end|>
<|im_start|>user
A tree needs to leave the earth and become astro-biological. How can it achieve it's goal?
<|im_end|>
<|im_start|>assistant
"""
input_ids = tokenizer(input_text, return_tensors='pt').to(model.device)["input_ids"]
outputs = model.generate(input_ids, max_new_tokens=1024, temperature=0.0, repetition_penalty=1.1)
print(tokenizer.batch_decode(outputs)[0])
# <|startoftext|><|im_start|>system
# You are a helpful AI assistant.
# <|im_end|>
# <|im_start|>user
# A tree needs to leave the earth and become astro-biological. How can it achieve it's goal?
# <|im_end|>
# <|im_start|>assistant
# The process of becoming astronautic life for a tree is an excemtally complicated one that requires a great deal of preparation, coordination, and funding. The first step in this process is for the tree to be identified as a potential candidate for astronautics, which may involve a thorough assessment of its size, health, and suitability for space travel.
# Once a tree has been identified as a possible astronautic life-form, the next step involves preparing it for spaceflight. This includes training the tree to tolerate low gravity environments, teaching it how to navigate in zero gravity, and ensuring that its nutritional needs are met in space. The process of acclimating a tree to spaceflight can take months or even years, depending on the species and the specific requirements of each mission.
# Once the tree has been adequately trained and prepared for spaceflight, it must then be transported into orbit or beyond. This may involve launching the tree aboard a rocket or shuttle, or using other methods such as balloons or parachutes to reach its destination. The journey itself can be long and arduous, with many potential risks and challenges along the way.
# Upon arrival in space, the tree will need to be monitored closely and cared for by astronautic personnel. This may involve feeding the tree, maintaining its health and well-being, and ensuring that it has enough water and nutrients to survive. The tree may also need to be protected from radiation, extreme temperatures, or other hazards that it may face in space.
# Over time, as the tree adapts to life in space, it will likely undergo some changes in its physical appearance and behavior. For example, it may begin growing in new ways, developing different kinds of leaves or branches in response to the unique environment it finds itself in. It may also become more active and mobile, using its roots to navigate and explore its new home.
# Throughout this process, there are many challenges that need to be addressed and overcome.<|im_end|>
# <|endoftext|>
示例輸出
<|startoftext|><|im_start|>system
You are a helpful AI assistant.
<|im_end|>
<|im_start|>user
A tree needs to leave the earth and become astro-biological. How can it achieve it's goal?
<|im_end|>
<|im_start|>assistant
The process of becoming astronautic life for a tree is an excemtally complicated one that requires a great deal of preparation, coordination, and funding. The first step in this process is for the tree to be identified as a potential candidate for astronautics, which may involve a thorough assessment of its size, health, and suitability for space travel.
Once a tree has been identified as a possible astronautic life-form, the next step involves preparing it for spaceflight. This includes training the tree to tolerate low gravity environments, teaching it how to navigate in zero gravity, and ensuring that its nutritional needs are met in space. The process of acclimating a tree to spaceflight can take months or even years, depending on the species and the specific requirements of each mission.
Once the tree has been adequately trained and prepared for spaceflight, it must then be transported into orbit or beyond. This may involve launching the tree aboard a rocket or shuttle, or using other methods such as balloons or parachutes to reach its destination. The journey itself can be long and arduous, with many potential risks and challenges along the way.
Upon arrival in space, the tree will need to be monitored closely and cared for by astronautic personnel. This may involve feeding the tree, maintaining its health and well-being, and ensuring that it has enough water and nutrients to survive. The tree may also need to be protected from radiation, extreme temperatures, or other hazards that it may face in space.
Over time, as the tree adapts to life in space, it will likely undergo some changes in its physical appearance and behavior. For example, it may begin growing in new ways, developing different kinds of leaves or branches in response to the unique environment it finds itself in. It may also become more active and mobile, using its roots to navigate and explore its new home.
Throughout this process, there are many challenges that need to be addressed and overcome.<|im_end|>
<|endoftext|>
🔧 技術細節
訓練信息
Hercules-v4.0 首次測試
- 1250 步(使用 A100 訓練 5 小時)
- 最終損失:0.98
超參數
lora_config = LoraConfig(
r=16,
lora_alpha=32,
target_modules=["embed_tokens", "x_proj", "in_proj", "out_proj"],
lora_dropout=0.05,
task_type="CAUSAL_LM",
bias="none"
)
trainer = SFTTrainer(
model=model,
train_dataset=train_dataset,
dataset_text_field="text",
max_seq_length=max_seq_length,
tokenizer=tokenizer,
args=TrainingArguments(
num_train_epochs=1,
lr_scheduler_type='cosine',
learning_rate=0.0002,
per_device_train_batch_size=1,
gradient_accumulation_steps=8,
gradient_checkpointing=True,
warmup_steps=10,
weight_decay=0.01,
fp16=not torch.cuda.is_bf16_supported(),
bf16=torch.cuda.is_bf16_supported(),
logging_steps=1,
save_steps=200,
output_dir="outputs",
optim="adamw_bnb_8bit",
adam_epsilon=0.00001,
adam_beta2=0.95,
max_grad_norm=1.0,
seed=42,
),
)
📄 許可證
本項目採用 Apache-2.0 許可證。
Phi 2 GGUF
其他
Phi-2是微軟開發的一個小型但強大的語言模型,具有27億參數,專注於高效推理和高質量文本生成。
大型語言模型 支持多種語言
P
TheBloke
41.5M
205
Roberta Large
MIT
基於掩碼語言建模目標預訓練的大型英語語言模型,採用改進的BERT訓練方法
大型語言模型 英語
R
FacebookAI
19.4M
212
Distilbert Base Uncased
Apache-2.0
DistilBERT是BERT基礎模型的蒸餾版本,在保持相近性能的同時更輕量高效,適用於序列分類、標記分類等自然語言處理任務。
大型語言模型 英語
D
distilbert
11.1M
669
Llama 3.1 8B Instruct GGUF
Meta Llama 3.1 8B Instruct 是一個多語言大語言模型,針對多語言對話用例進行了優化,在常見的行業基準測試中表現優異。
大型語言模型 英語
L
modularai
9.7M
4
Xlm Roberta Base
MIT
XLM-RoBERTa是基於100種語言的2.5TB過濾CommonCrawl數據預訓練的多語言模型,採用掩碼語言建模目標進行訓練。
大型語言模型 支持多種語言
X
FacebookAI
9.6M
664
Roberta Base
MIT
基於Transformer架構的英語預訓練模型,通過掩碼語言建模目標在海量文本上訓練,支持文本特徵提取和下游任務微調
大型語言模型 英語
R
FacebookAI
9.3M
488
Opt 125m
其他
OPT是由Meta AI發佈的開放預訓練Transformer語言模型套件,參數量從1.25億到1750億,旨在對標GPT-3系列性能,同時促進大規模語言模型的開放研究。
大型語言模型 英語
O
facebook
6.3M
198
1
基於transformers庫的預訓練模型,適用於多種NLP任務
大型語言模型
Transformers

1
unslothai
6.2M
1
Llama 3.1 8B Instruct
Llama 3.1是Meta推出的多語言大語言模型系列,包含8B、70B和405B參數規模,支持8種語言和代碼生成,優化了多語言對話場景。
大型語言模型
Transformers 支持多種語言

L
meta-llama
5.7M
3,898
T5 Base
Apache-2.0
T5基礎版是由Google開發的文本到文本轉換Transformer模型,參數規模2.2億,支持多語言NLP任務。
大型語言模型 支持多種語言
T
google-t5
5.4M
702
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98