Upload Llama-3-13B-Instruct-v0.1.Q4_K_S.gguf with huggingface_hub

This commit is contained in:
ai-modelscope
2024-09-14 13:03:43 +08:00
parent af2e814288
commit 460c852c81
16 changed files with 187 additions and 53 deletions

159
README.md
View File

@@ -1,47 +1,128 @@
---
license: Apache License 2.0
#model-type:
##如 gpt、phi、llama、chatglm、baichuan 等
#- gpt
base_model: "meta-llama/Meta-Llama-3-8B-Instruct"
library_name: transformers
tags:
- mergekit
- merge
- facebook
- meta
- pytorch
- llama
- llama-3
language:
- en
pipeline_tag: text-generation
license: other
license_name: llama3
license_link: LICENSE
inference: false
model_creator: MaziyarPanahi
model_name: Llama-3-13B-Instruct-v0.1
quantized_by: MaziyarPanahi
#domain:
##如 nlp、cv、audio、multi-modal
#- nlp
#language:
##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa
#- cn
#metrics:
##如 CIDEr、Blue、ROUGE 等
#- CIDEr
#tags:
##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他
#- pretrained
#tools:
##如 vllm、fastchat、llamacpp、AdaSeq 等
#- vllm
---
### 当前模型的贡献者未提供更加详细的模型介绍。模型文件和权重,可浏览“模型文件”页面获取。
#### 您可以通过如下git clone命令或者ModelScope SDK来下载模型
SDK下载
```bash
#安装ModelScope
pip install modelscope
```
![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)
# QuantFactory/Llama-3-13B-Instruct-v0.1-GGUF
This is quantized version of [MaziyarPanahi/Llama-3-13B-Instruct-v0.1](https://huggingface.co/MaziyarPanahi/Llama-3-13B-Instruct-v0.1) created using llama.cpp
# Original Model Card
<img src="./llama-3-merges.webp" alt="Goku 8x22B v0.1 Logo" width="500" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
# Llama-3-13B-Instruct-v0.1
This model is a self-merge of `meta-llama/Meta-Llama-3-8B-Instruct` model.
# How to use
You can use this model by using `MaziyarPanahi/Llama-3-13B-Instruct-v0.1` as the model name in Hugging Face's
transformers library.
```python
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('QuantFactory/Llama-3-13B-Instruct-v0.1-GGUF')
```
Git下载
```
#Git模型下载
git clone https://www.modelscope.cn/QuantFactory/Llama-3-13B-Instruct-v0.1-GGUF.git
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
from transformers import pipeline
import torch
model_id = "MaziyarPanahi/Llama-3-13B-Instruct-v0.1"
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True,
# attn_implementation="flash_attention_2"
)
tokenizer = AutoTokenizer.from_pretrained(
model_id,
trust_remote_code=True
)
streamer = TextStreamer(tokenizer)
pipeline = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
model_kwargs={"torch_dtype": torch.bfloat16},
streamer=streamer
)
# Then you can use the pipeline to generate text.
messages = [
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
{"role": "user", "content": "Who are you?"},
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
terminators = [
tokenizer.eos_token_id,
tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipeline(
prompt,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=0.95,
)
print(outputs[0]["generated_text"][len(prompt):])
```
<p style="color: lightgrey;">如果您是本模型的贡献者,我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>,及时完善模型卡片内容。</p>
## Prompt template
```text
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
You are a helpful assistant.<|eot_id|><|start_header_id|>user<|end_header_id|>
what's 25-4*2+3<|eot_id|><|start_header_id|>assistant<|end_header_id|>
To evaluate this expression, we need to follow the order of operations (PEMDAS):
1. First, multiply 4 and 2: 4*2 = 8
2. Then, subtract 8 from 25: 25 - 8 = 17
3. Finally, add 3: 17 + 3 = 20
So, 25-4*2+3 = 20!<|eot_id|>
To evaluate this expression, we need to follow the order of operations (PEMDAS):
1. First, multiply 4 and 2: 4*2 = 8
2. Then, subtract 8 from 25: 25 - 8 = 17
3. Finally, add 3: 17 + 3 = 20
So, 25-4*2+3 = 20!
```