🚀 Cosmos LLaMa
Cosmos LLaMa是基於LLaMA - 3 8B模型,使用30GB土耳其語數據集進行全量微調得到的模型。它專為文本生成任務設計,能夠以連貫且符合上下文的方式續寫給定的文本片段。不過,由於訓練數據來源廣泛,包含網站、書籍等多種文本,該模型可能存在偏差,使用者需注意並負責任地使用。
🚀 快速開始
本部分將展示如何在colab中使用該模型。
✨ 主要特性
- 基於LLaMA - 3 8B模型全量微調。
- 採用30GB土耳其語數據集訓練。
- 可用於文本生成任務,能連貫續寫文本。
📦 安裝指南
在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。
- 本研究得到了谷歌TPU研究雲(TRC)的Cloud TPU支持。
聯繫方式
伊迪茲技術大學計算機工程系COSMOS AI研究小組
https://cosmos.yildiz.edu.tr/
cosmos@yildiz.edu.tr
引用
如需引用該模型,請使用以下BibTeX格式:
@inproceedings{kesgin2024optimizing,
title={Optimizing Large Language Models for Turkish: New Methodologies in Corpus Selection and Training},
author={Kesgin, H Toprak and Yuce, M Kaan and Dogan, Eren and Uzun, M Egemen and Uz, Atahan and {\.I}nce, Elif and Erdem, Yusuf and Shbib, Osama and Zeer, Ahmed and Amasyali, M Fatih},
booktitle={2024 Innovations in Intelligent Systems and Applications Conference (ASYU)},
pages={1--6},
year={2024},
organization={IEEE}
}
📄 許可證
本模型使用的許可證為llama3。
屬性 |
詳情 |
模型類型 |
文本生成 |
基礎模型 |
meta - llama/Meta - Llama - 3 - 8B |
許可證 |
llama3 |
語言 |
土耳其語 |