Tonya77 commited on
Commit
cecafbd
·
verified ·
1 Parent(s): 415c180

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +144 -3
README.md CHANGED
@@ -1,3 +1,144 @@
1
- ---
2
- license: llama3.1
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3.1
3
+ language:
4
+ - zh
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - facebook
8
+ - meta
9
+ - pytorch
10
+ - llama
11
+ - llama-3
12
+ - ContaLLM
13
+ - ContaAI
14
+ base_model:
15
+ - meta-llama/Llama-3.1-8B-Instruct
16
+ library_name: transformers
17
+ ---
18
+
19
+ <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'"/>
20
+
21
+ # ContaLLM-Beauty-8B-Instruct
22
+
23
+ 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.
24
+
25
+ ## Model description
26
+
27
+ - **Model type:** A model trained on a mix of publicly available, synthetic and human-annotated datasets.
28
+ - **Language(s) (NLP):** Primarily Chinese
29
+ - **Industry:** Food And Beverage Industry Marketing
30
+ - **License:** Llama 3.1 Community License Agreement
31
+ - **Finetuned from model:** meta-llama/Llama-3.1-8B-Instruct
32
+
33
+ ### Model Stage
34
+
35
+ | **Industry** | **Version** | **Llama 3.1 8B**
36
+ |--------------|-------------|------------------------------------------------------------------------------------------------------------|
37
+ | **Beauty** | **bf16** | [ContaAI/ContaLLM-Food-Beverage-8B-Instruct](https://huggingface.co/ContaAI/ContaLLM-Food-Beverage-8B-Instruct) |
38
+ | **Beauty** | **8bit** | [ContaAI/ContaLLM-Food-Beverage-8B-Instruct-8bit](https://huggingface.co/ContaAI/ContaLLM-Food-Beverage-8B-Instruct-8bit) |
39
+ | **Beauty** | **4bit** | [ContaAI/ContaLLM-Food-Beverage-8B-Instruct-4bit](https://huggingface.co/ContaAI/ContaLLM-Food-Beverage-8B-Instruct-4bit) |
40
+
41
+ ## Using the model
42
+
43
+ ### Loading with HuggingFace
44
+
45
+ To load the model with HuggingFace, use the following snippet:
46
+ ```
47
+ from transformers import AutoModelForCausalLM
48
+
49
+ model = AutoModelForCausalLM.from_pretrained("ContaAI/ContaLLM-Food-Beverage-8B-Instruct-8bit")
50
+ ```
51
+
52
+
53
+ ### System Prompt
54
+
55
+ The model is a Chinese beauty marketing model, so we use this system prompt by default:
56
+ ```
57
+ system_prompt = '请根据用户提供的营销需求、选品及其他信息写一篇食品饮料行业的营销推文。'
58
+ ```
59
+
60
+ ### User Prompt
61
+ 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:
62
+
63
+ | Parameter name | Required | Meaning and optional range |
64
+ |-------------------|-----------------------|------------------------------------------------------------------------------------------------------|
65
+ | **营销需求** | required | Fill in your marketing requirements, cannot be blank |
66
+ | **选品** | required | Fill in your product selection, cannot be blank |
67
+ | **选品知识库** | required | Fill in your product selection knowledge base, cannot be blank |
68
+ | **关键词** | optional | Fill in your marketing keywords, or remove this row from the prompt |
69
+ | **标签** | optional | Fill in the hashtag, or remove this row from the prompt |
70
+ | **主推卖点** | optional | Fill in the main recommended selling points, or remove this row from the prompt |
71
+ | **主推场景** | optional | Fill in the main recommended scenes, or remove this row from the prompt |
72
+ | **文章类型** | optional | Fill in the article type, or remove this row from the prompt |
73
+
74
+ Example:
75
+ ```
76
+ user_prompt = """营销需求:夏日清凉,日料风味体验
77
+ 选品:清新柠檬寿司卷
78
+ 选品知识库:1、选用新鲜的三文鱼和牛油果,搭配清爽柠檬汁,口感层次丰富。2、低脂健康,适合健身人士。3、每份仅含200大卡,轻松享受美味。
79
+ 关键词:日料、寿司、健康饮食、夏日美食
80
+ 主推卖点:清新健康
81
+ 主推场景:夏日聚会
82
+ 标签:#日料# #寿司# #健康美食
83
+ 文章类型:美食推荐"""
84
+ ```
85
+
86
+ ### Use example (with template)
87
+ ```
88
+ import torch
89
+ from transformers import AutoModelForCausalLM, AutoTokenizer
90
+ model_name = "ContaAI/ContaLLM-Food-Beverage-8B-Instruct-8bit"
91
+ model = AutoModelForCausalLM.from_pretrained(model_name, load_in_8bit=True, device_map="auto")
92
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
93
+
94
+ system_prompt = '请根据用户提供的营销需求、选品及其他信息写一篇食品饮料行业的营销推文。'
95
+
96
+ user_prompt = """营销需求:夏日清凉,日料风味体验
97
+ 选品:清新柠檬寿司卷
98
+ 选品知识库:1、选用新鲜的三文鱼和牛油果,搭配清爽柠檬汁,口感层次丰富。2、低脂健康,适合健身人士。3、每份仅含200大卡,轻松享受美味。
99
+ 关键词:日料、寿司、健康饮食、夏日美食
100
+ 主推卖点:清新健康
101
+ 主推场景:夏日聚会
102
+ 标签:#日料# #寿司# #健康美食
103
+ 文章类型:美食推荐"""
104
+
105
+ prompt_template = '''<|begin_of_text|><|start_header_id|>system<|end_header_id|>
106
+ {}<|eot_id|><|start_header_id|>user<|end_header_id|>
107
+ {}<|eot_id|><|start_header_id|>assistant<|end_header_id|>'''
108
+
109
+ prompt = prompt_template.format(system_prompt, user_prompt)
110
+
111
+ tokenized_message = tokenizer(
112
+ prompt,
113
+ max_length=2048,
114
+ return_tensors="pt",
115
+ add_special_tokens=False
116
+ )
117
+
118
+ response_token_ids= model.generate(
119
+ **tokenized_message,
120
+ max_new_tokens=1024,
121
+ do_sample=True,
122
+ top_p=1.0,
123
+ temperature=0.5,
124
+ min_length=None,
125
+ use_cache=True,
126
+ top_k=50,
127
+ repetition_penalty=1.2,
128
+ length_penalty=1,
129
+ )
130
+
131
+ generated_tokens = response_token_ids[0, tokenized_message['input_ids'].shape[-1]:]
132
+ generated_text = tokenizer.decode(generated_tokens, skip_special_tokens=True)
133
+ print(generated_text)
134
+ ```
135
+
136
+ ### Bias, Risks, and Limitations
137
+
138
+ 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).
139
+ 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.
140
+ 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.
141
+
142
+ ## License and use
143
+
144
+ All Llama 3.1 ContaAI models are released under Meta's [Llama 3.1 Community License Agreement](https://www.llama.com/llama3_1/license/).