Falcon-7B 是由 TII 构建的一个拥有 70 亿参数的因果解码器模型,它在 15000 亿 tokens 的 RefinedWeb 数据上进行训练,并辅以精选语料库。该模型在 Apache 2.0 许可下发布。
⚠️ 这是一个原始的预训练模型,在大多数使用场景下需要进一步微调。 如果您需要一个更适合以聊天格式接收通用指令的版本,我们建议您关注 Falcon-7B-Instruct。
🔥 想要更强大的模型? Falcon-40B 是 Falcon-7B 的“大哥”!
💥 使用 openmind 时,Falcon LLM 系列需要 PyTorch 2.0 版本支持!
如需快速推理 Falcon,请查看 Text Generation Inference!更多信息请阅读此博客文章。
运行 Falcon-7B 推理至少需要 16GB 内存以确保流畅运行。
大型语言模型相关研究;作为进一步专门化和微调到特定用途(例如摘要、文本生成、聊天机器人等)的基础模型。
未经充分风险评估和缓解措施的生产环境使用;任何可能被视为不负责任或有害的使用场景。
Falcon-7B 仅在英语和法语数据上训练,因此无法很好地泛化到其他语言。此外,由于其训练数据来自大规模网络语料库,它将携带网络上常见的刻板印象和偏见。
我们建议 Falcon-7B 的用户考虑针对特定的目标任务集对其进行微调,并在任何生产环境使用时采取防护措施和适当的预防手段。
from openmind import pipeline, AutoTokenizer, AutoModelForCausalLM
import openmind
import torch
import torch_npu
import argparse
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
type=str,
help="Jinan_AICC/Falcon-7B",
default="Jinan_AICC/Falcon-7B",
)
args = parser.parse_args()
return args
args = parse_args()
model = args.model_name_or_path
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = openmind.pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto",
)
sequences = pipeline(
"Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
max_length=200,
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")