File size: 7,479 Bytes
27a1e54 871da84 27a1e54 03a2db1 27a1e54 59bdbdd 27a1e54 59bdbdd 27a1e54 59bdbdd 27a1e54 03a2db1 27a1e54 f237656 27a1e54 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
---
license: llama3.1
language:
- zh
pipeline_tag: text-generation
tags:
- facebook
- meta
- pytorch
- llama
- llama-3
- ContaLLM
- ContaAI
base_model:
- meta-llama/Llama-3.1-8B-Instruct
library_name: transformers
---
<img src="https://conta-ai-image.oss-cn-shanghai.aliyuncs.com/contaai/logo2.png" alt="ContaLLM" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
# ContaLLM-Food-Beverage-8B-Instruct
ContaLLM-Food-Beverage-8B-Instruct is a large Chinese vertical marketing model for the food and beverage industry. You can customize and generate marketing texts according to users' specific marketing needs, product selection, product selection knowledge base, keywords, main recommended selling points, main recommended scenes, hashtags, article types, etc. Use the LLM's capabilities and training on existing high-quality marketing materials to help companies generate diversified, high-quality marketing content and improve marketing conversion rates.
## Model description
- **Model type:** A model trained on a mix of publicly available, synthetic and human-annotated datasets.
- **Language(s) (NLP):** Primarily Chinese
- **Industry:** Food And Beverage Industry Marketing
- **License:** Llama 3.1 Community License Agreement
- **Finetuned from model:** meta-llama/Llama-3.1-8B-Instruct
### Model Stage
| **Industry** | **Version** | **Llama 3.1 8B**
|--------------|-------------|------------------------------------------------------------------------------------------------------------|
| **Food And Beverage** | **bf16** | [ContaAI/ContaLLM-Food-Beverage-8B-Instruct](https://huggingface.co/ContaAI/ContaLLM-Food-Beverage-8B-Instruct) |
| **Food And Beverage** | **8bit** | [ContaAI/ContaLLM-Food-Beverage-8B-Instruct-8bit](https://huggingface.co/ContaAI/ContaLLM-Food-Beverage-8B-Instruct-8bit) |
| **Food And Beverage** | **4bit** | [ContaAI/ContaLLM-Food-Beverage-8B-Instruct-4bit](https://huggingface.co/ContaAI/ContaLLM-Food-Beverage-8B-Instruct-4bit) |
## Using the model
### Loading with HuggingFace
To load the model with HuggingFace, use the following snippet:
```
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("ContaAI/ContaLLM-Food-Beverage-8B-Instruct")
```
### System Prompt
This model is a Chinese marketing model for food and beverage industry, so we use this system prompt by default:
```
system_prompt = '请根据用户提供的营销需求、选品及其他信息写一篇食品饮料行业的营销推文。'
```
### User Prompt
Users can enter the required marketing needs according to their own needs, non-required including keywords, topics, label marketing nodes, people, related materials, content length, which content length has three specifications, respectively, shorter, medium, longer. The details are as follows:
| Parameter name | Required | Meaning and optional range |
|-------------------|-----------------------|------------------------------------------------------------------------------------------------------|
| **营销需求** | required | Fill in your marketing requirements, cannot be blank |
| **选品** | required | Fill in your product selection, cannot be blank |
| **选品知识库** | required | Fill in the relevant information/materials about your product, cannot be blank |
| **关键词** | optional | Fill in your marketing keywords, or remove this row from the prompt |
| **标签** | optional | Fill in the hashtag, or remove this row from the prompt |
| **主推卖点** | optional | Fill in the main recommended selling points, or remove this row from the prompt |
| **主推场景** | optional | Fill in the main recommended scenes, or remove this row from the prompt |
| **文章类型** | optional | Fill in the article type, or remove this row from the prompt |
Example:
```
user_prompt = """营销需求:夏日清凉,日料风味体验
选品:清新柠檬寿司卷
选品知识库:1、选用新鲜的三文鱼和牛油果,搭配清爽柠檬汁,口感层次丰富。2、低脂健康,适合健身人士。3、每份仅含200大卡,轻松享受美味。
关键词:日料、寿司、健康饮食、夏日美食
主推卖点:清新健康
主推场景:夏日聚会
标签:#日料# #寿司# #健康美食
文章类型:美食推荐"""
```
### Use example (with template)
```
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "ContaAI/ContaLLM-Food-Beverage-8B-Instruct"
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_name)
system_prompt = '请根据用户提供的营销需求、选品及其他信息写一篇食品饮料行业的营销推文。'
user_prompt = """营销需求:夏日清凉,日料风味体验
选品:清新柠檬寿司卷
选品知识库:1、选用新鲜的三文鱼和牛油果,搭配清爽柠檬汁,口感层次丰富。2、低脂健康,适合健身人士。3、每份仅含200大卡,轻松享受美味。
关键词:日料、寿司、健康饮食、夏日美食
主推卖点:清新健康
主推场景:夏日聚会
标签:#日料# #寿司# #健康美食
文章类型:美食推荐"""
prompt_template = '''<|begin_of_text|><|start_header_id|>system<|end_header_id|>
{}<|eot_id|><|start_header_id|>user<|end_header_id|>
{}<|eot_id|><|start_header_id|>assistant<|end_header_id|>'''
prompt = prompt_template.format(system_prompt, user_prompt)
tokenized_message = tokenizer(
prompt,
max_length=2048,
return_tensors="pt",
add_special_tokens=False
)
response_token_ids= model.generate(
**tokenized_message,
max_new_tokens=1024,
do_sample=True,
top_p=1.0,
temperature=0.5,
min_length=None,
use_cache=True,
top_k=50,
repetition_penalty=1.2,
length_penalty=1,
)
generated_tokens = response_token_ids[0, tokenized_message['input_ids'].shape[-1]:]
generated_text = tokenizer.decode(generated_tokens, skip_special_tokens=True)
print(generated_text)
```
### Bias, Risks, and Limitations
The ContaLLM models implemented safety techniques during data generation and training, but they are not deployed automatically with in-the-loop filtering of responses like ChatGPT during inference, so the model can produce problematic outputs (especially when prompted to do so).
It is also unknown what the size and composition of the corpus was used to train the base Llama 3.1 models, however it is likely to have included a mix of Web data and technical sources like books and code.
The use of the models is at your own risk. You may need to monitor the outputs of the model and take appropriate actions such as content filtering if necessary.
## License and use
All Llama 3.1 ContaAI models are released under Meta's [Llama 3.1 Community License Agreement](https://www.llama.com/llama3_1/license/).
|