Turkish Llama 8b V0.1 GGUF
模型简介
该模型专为土耳其语文本生成任务设计,能够以连贯且与上下文相关的方式继续给定的文本片段。
模型特点
土耳其语优化
专门针对土耳其语进行了全面微调,提升了土耳其语文本生成质量
大容量训练数据
使用了30GB的高质量土耳其语数据集进行训练
连贯性生成
能够生成与上下文连贯一致的土耳其语文本
模型能力
土耳其语文本生成
文本续写
上下文相关文本生成
使用案例
内容创作
土耳其语文章写作
辅助创作土耳其语文章、博客等内容
生成流畅自然的土耳其语文本
教育
土耳其语学习辅助
为土耳其语学习者提供语言练习和示例
生成符合语法规范的土耳其语例句
🚀 土耳其语-Llama-8b-v0.1-GGUF
本项目提供了 土耳其语-Llama-8b-v0.1 模型的 GGUF 格式文件。GGUF 是一种新的模型格式,支持众多客户端和库,方便用户在不同环境下使用该模型进行文本生成任务。
🚀 快速开始
下载模型文件
- 自动下载:LM Studio、LoLLMS Web UI、Faraday.dev 等客户端/库会自动提供可用模型列表,供你选择下载。
- text-generation-webui 下载:在
text-generation-webui
的Download Model
中,输入模型仓库地址LiteLLMs/Turkish-Llama-8b-v0.1-GGUF
,并指定具体文件名,如Q4_0/Q4_0-00001-of-00009.gguf
,然后点击Download
。 - 命令行下载:推荐使用
huggingface-hub
Python 库,先安装:
pip3 install huggingface-hub
然后使用以下命令下载单个模型文件到当前目录:
huggingface-cli download LiteLLMs/Turkish-Llama-8b-v0.1-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
运行模型
llama.cpp 命令示例
确保使用的 llama.cpp
是 d0cee0d 或更高版本。
./main -ngl 35 -m Q4_0/Q4_0-00001-of-00009.gguf --color -c 8192 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<PROMPT>"
-ngl 32
:指定卸载到 GPU 的层数,若没有 GPU 加速可移除该参数。-c 8192
:指定所需的序列长度,对于扩展序列模型,必要的 RoPE 缩放参数会从 GGUF 文件中读取并由 llama.cpp 自动设置。注意,更长的序列长度需要更多资源,可能需要减小该值。- 若要进行聊天式对话,将
-p <PROMPT>
参数替换为-i -ins
。
在 text-generation-webui 中运行
更多说明可参考 text-generation-webui 文档。
从 Python 代码运行
可以使用 llama-cpp-python 或 ctransformers 库从 Python 中使用 GGUF 模型。建议使用 llama-cpp-python。
from llama_cpp import Llama
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
llm = Llama(
model_path="./Q4_0/Q4_0-00001-of-00009.gguf", # Download the model file first
n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
)
# Simple inference example
output = llm(
"<PROMPT>", # Prompt
max_tokens=512, # Generate up to 512 tokens
stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
echo=True # Whether to echo the prompt
)
# Chat Completion API
llm = Llama(model_path="./Q4_0/Q4_0-00001-of-00009.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
llm.create_chat_completion(
messages = [
{"role": "system", "content": "You are a story writing assistant."},
{
"role": "user",
"content": "Write a story about llamas."
}
]
)
与 LangChain 结合使用
✨ 主要特性
- 多客户端支持:支持众多客户端和库,如 llama.cpp、text-generation-webui、Ollama 等,方便在不同环境下使用。
- GPU 加速:部分客户端和库支持 GPU 加速,提高模型运行效率。
- 文本生成能力:基于土耳其语数据集微调,可用于生成连贯且与上下文相关的文本。
📦 安装指南
安装依赖库
下载模型文件依赖
pip3 install huggingface-hub
Python 代码运行依赖
# Base ctransformers with no GPU acceleration
pip install llama-cpp-python
# With NVidia CUDA acceleration
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
# Or with OpenBLAS acceleration
CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
# Or with CLBLast acceleration
CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
# Or with AMD ROCm GPU acceleration (Linux only)
CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
# Or with Metal GPU acceleration for macOS systems only
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
$env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
pip install llama-cpp-python
💻 使用示例
基础用法
from llama_cpp import Llama
llm = Llama(model_path="./Q4_0/Q4_0-00001-of-00009.gguf", n_ctx=32768, n_threads=8, n_gpu_layers=35)
output = llm("<PROMPT>", max_tokens=512, stop=["</s>"], echo=True)
print(output)
高级用法
# Chat Completion API
from llama_cpp import Llama
llm = Llama(model_path="./Q4_0/Q4_0-00001-of-00009.gguf", chat_format="llama-2")
messages = [
{"role": "system", "content": "You are a story writing assistant."},
{"role": "user", "content": "Write a story about llamas."}
]
response = llm.create_chat_completion(messages)
print(response)
📚 详细文档
关于 GGUF 格式
GGUF 是 llama.cpp 团队在 2023 年 8 月 21 日引入的新格式,用于替代不再受 llama.cpp 支持的 GGML 格式。以下是已知支持 GGUF 的客户端和库:
- llama.cpp:GGUF 的源项目,提供命令行界面 (CLI) 和服务器选项。
- text-generation-webui:最广泛使用的 Web UI,功能丰富,支持 GPU 加速。
- Ollama:轻量级可扩展框架,用于在本地构建和运行语言模型。
- KoboldCpp:全面的 Web UI,支持所有平台和架构的 GPU 加速,尤其适用于故事创作。
- GPT4All:免费开源的本地 GUI,支持 Windows、Linux 和 macOS,全 GPU 加速。
- LM Studio:适用于 Windows 和 macOS (Silicon) 的直观强大的本地 GUI,支持 GPU 加速。
- LoLLMS Web UI:具有多种独特功能的 Web UI,包含综合模型库,方便模型选择。
- Faraday.dev:适用于 Windows 和 macOS (Silicon 和 Intel) 的美观易用的基于角色的聊天 GUI,支持 GPU 加速。
- llama-cpp-python:配备 GPU 加速、LangChain 支持和 OpenAI 兼容 API 服务器的 Python 库。
- candle:基于 Rust 的 ML 框架,注重性能,支持 GPU,易于使用。
- ctransformers:具有 GPU 加速、LangChain 支持和 OpenAI 兼容 AI 服务器的 Python 库。
- localGPT:开源项目,支持与文档进行私密对话。
量化方法说明
点击查看详情
新的量化方法如下: - **GGML_TYPE_Q2_K**:“type-1” 2 位量化,超级块包含 16 个块,每个块有 16 个权重。块的比例和最小值用 4 位量化,最终每个权重有效使用 2.5625 位 (bpw)。 - **GGML_TYPE_Q3_K**:“type-0” 3 位量化,超级块包含 16 个块,每个块有 16 个权重。比例用 6 位量化,最终使用 3.4375 bpw。 - **GGML_TYPE_Q4_K**:“type-1” 4 位量化,超级块包含 8 个块,每个块有 32 个权重。比例和最小值用 6 位量化,最终使用 4.5 bpw。 - **GGML_TYPE_Q5_K**:“type-1” 5 位量化,与 GGML_TYPE_Q4_K 具有相同的超级块结构,最终使用 5.5 bpw。 - **GGML_TYPE_Q6_K**:“type-0” 6 位量化,超级块有 16 个块,每个块有 16 个权重。比例用 8 位量化,最终使用 6.5625 bpw。🔧 技术细节
模型信息
属性 | 详情 |
---|---|
模型类型 | 基于 LLaMA-3 8B 模型的全微调版本 |
训练数据 | 30GB 土耳其语数据集,包括网站、书籍和其他文本来源 |
模型局限性
由于训练数据的多样性,模型可能存在偏差。用户应意识到这些偏差,并负责任地使用模型。
📄 许可证
本项目使用 llama3 许可证。
原模型卡片:土耳其语-Llama-8b-v0.1
Cosmos LLaMa
该模型是基于 LLaMA-3 8B 模型,使用 30GB 土耳其语数据集进行全微调的版本。Cosmos LLaMa 专为文本生成任务设计,能够以连贯且与上下文相关的方式继续给定的文本片段。由于训练数据的多样性,该模型可能存在偏差,用户应注意这些偏差并负责任地使用模型。
示例用法
在 Colab 中使用模型的示例:
!pip install -U accelerate bitsandbytes
import torch
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
from transformers import BitsAndBytesConfig
import time
model_name = "ytu-ce-cosmos/Turkish-Llama-8b-v0.1"
bnb_config = BitsAndBytesConfig(
load_in_8bit=True,
bnb_8bit_compute_dtype=torch.bfloat16,
load_in_8bit_fp32_cpu_offload=True,
device_map = 'auto'
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto",
torch_dtype=torch.bfloat16,
quantization_config=bnb_config,
)
text_generator = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
device_map="auto",
temperature=0.3,
repetition_penalty=1.1,
top_p=0.9,
max_length=610,
do_sample=True,
return_full_text=False,
min_new_tokens=32
)
text = """Yapay zeka hakkında 3 tespit yaz.\n"""
r = text_generator(text)
print(r[0]['generated_text'])
"""
1. Yapay Zeka (AI), makinelerin insan benzeri bilişsel işlevleri gerçekleştirmesini sağlayan bir teknoloji alanıdır.
2. Yapay zekanın geliştirilmesi ve uygulanması, sağlık hizmetlerinden eğlenceye kadar çeşitli sektörlerde çok sayıda fırsat sunmaktadır.
3. Yapay zeka teknolojisinin potansiyel faydaları önemli olsa da mahremiyet, işten çıkarma ve etik hususlar gibi konularla ilgili endişeler de var.
"""
致谢
- 感谢 Hugging Face 团队的慷慨支持,使得可以从他们的 S3 存储中下载模型 🤗
- 本工作使用的计算资源由土耳其国家高性能计算中心 (UHeM) 提供,资助编号为 1016912023 和 1018512024
- 研究得到了 Google 的 TPU 研究云 (TRC) 的 Cloud TPU 支持
联系信息
COSMOS AI 研究小组,伊迪兹技术大学计算机工程系
- 网站:https://cosmos.yildiz.edu.tr/
- 邮箱:cosmos@yildiz.edu.tr
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