Views
No views yet

| Industry | Version | Qwen 2.5 7B |
|---|---|---|
| Fashion | bf16 | ContaAI/ContaLLM-Fashion-7B-Instruct |
| Fashion | 8bit | ContaAI/ContaLLM-Fashion-7B-Instruct-8bit |
| Fashion | 4bit | ContaAI/ContaLLM-Fashion-7B-Instruct-4bit |
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("ContaAI/ContaLLM-Fashion-7B-Instruct-4bit")system_prompt = '请根据用户提供的营销需求和其他信息写一篇时尚行业的营销推文。'| Parameter name | Required | Meaning and optional range |
|---|---|---|
| 营销需求 | required | Fill in your marketing requirements, cannot be blank |
| 品牌 | optional | Fill in your marketing brand, or remove this row from the prompt |
| 选品 | optional | Fill in your product selection, or remove this row from the prompt |
| 内容类型 | optional | Fill in the article type, or remove this row from the prompt |
| 内容长度 | optional | choices=['较长', '中等', '较短'], choose what you need, or remove this row from the prompt |
| 话题 | optional | Fill in your marketing topic, or remove this row from the prompt |
| 卖点 | optional | Fill in the selling point for your marketing needs, or remove this row from the prompt |
| 标签 | optional | Fill in the hashtag, or remove this row from the prompt |
| 场景 | optional | Fill in the scenes for your marketing needs, or remove this row from the prompt |
user_prompt = """营销需求:秋冬大包包推荐
品牌:Celine
选品:CELINE托特包
内容类型:产品种草与测评
内容长度:较短
话题:CELINE托特包、秋冬大包包、托特包用途
卖点:慵懒设计、大容量、新款限定设计
标签:CELINE、托特包、新品
场景:日常通勤、妈咪包使用、秋冬搭配"""import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "ContaAI/ContaLLM-Fashion-7B-Instruct-4bit"
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_name)
system_prompt = '请根据用户提供的营销需求和其他信息写一篇时尚行业的营销推文。'
user_prompt = """营销需求:秋冬大包包推荐
品牌:Celine
选品:CELINE托特包
内容类型:产品种草与测评
内容长度:较短
话题:CELINE托特包、秋冬大包包、托特包用途
卖点:慵懒设计、大容量、新款限定设计
标签:CELINE、托特包、新品
场景:日常通勤、妈咪包使用、秋冬搭配"""
prompt_template = '''<|im_start|>system
{}<|im_end|>
<|im_start|>user
{}<|im_end|>
<|im_start|>assistant
'''
prompt = prompt_template.format(system_prompt, user_prompt)
tokenized_message = tokenizer(
prompt,
max_length=1024,
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)