BAAI/IndustryInstruction
Viewer • Updated • 2.71M • 357 • 33
This repository is publicly accessible, but you have to accept the conditions to access its files and content.
You agree to not use the dataset to conduct experiments that cause harm to human subjects.
Log in or Sign Up to review the conditions and access this model content.
This model is fine-tuned from Llama 3.1 8B Instruct using BAAI/IndustryInstruction_Hospitality-Catering. See BAAI/IndustryInstruction for details about the full dataset.
The training framework is llama-factory, template=llama3
learning_rate=1e-5
lr_scheduler_type=cosine
max_length=2048
warmup_ratio=0.05
batch_size=64
epoch=10
select best ckpt by the evaluation loss
Duto to there is no evaluation benchmark, we can not eval the model
# !/usr/bin/env python
# -*- coding:utf-8 -*-
# ==================================================================
# [Author] : xiaofeng
# [Descriptions] :
# ==================================================================
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
llama3_jinja = """{% if messages[0]['role'] == 'system' %}
{% set offset = 1 %}
{% else %}
{% set offset = 0 %}
{% endif %}
{{ bos_token }}
{% for message in messages %}
{% if (message['role'] == 'user') != (loop.index0 % 2 == offset) %}
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}
{% endif %}
{{ '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n' + message['content'] | trim + '<|eot_id|>' }}
{% endfor %}
{% if add_generation_prompt %}
{{ '<|start_header_id|>' + 'assistant' + '<|end_header_id|>\n\n' }}
{% endif %}"""
dtype = torch.bfloat16
model_dir = "XiaofengAlg/Hospitality-llama3_1_8B_instruct"
model = AutoModelForCausalLM.from_pretrained(
model_dir,
device_map="cuda",
torch_dtype=dtype,
)
tokenizer = AutoTokenizer.from_pretrained(model_dir)
tokenizer.chat_template = llama3_jinja # update template
message = [
{"role": "system", "content": "You are a helpful assistant"},
{
"role": "user",
"content": "请举例说明在住宿与餐饮行业中,灵活用工模式的真实运用场景,以及它如何促进从业者的发展。",
},
]
prompt = tokenizer.apply_chat_template(
message, tokenize=False, add_generation_prompt=True
)
print(prompt)
inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
prompt_length = len(inputs[0])
print(f"prompt_length:{prompt_length}")
generating_args = {
"do_sample": True,
"temperature": 1.0,
"top_p": 0.5,
"top_k": 15,
"max_new_tokens": 512,
}
generate_output = model.generate(input_ids=inputs.to(model.device), **generating_args)
response_ids = generate_output[:, prompt_length:]
response = tokenizer.batch_decode(
response_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True
)[0]
"""
灵活用工模式在住宿与餐饮行业中的应用场景主要体现在以下几个方面:首先,酒店和餐厅可以根据业务需求灵活调整员工的工作时间和地点,例如,使用灵活用工模式可以让前台接待员工在客流量高峰期工作更多时间,而在低谷期则可以减少工作量,节省人力成本。其次,灵活用工模式还可以帮助企业进行员工培训和提升,例如,通过在线学习平台,员工可以在非工作时间学习新的技能或知识,提高个人能力。最后,灵活用工模式还可以促进员工的发展,例如,通过灵活调度,员工可以有更多的时间和机会从事更有价值的工作,如客户关系管理、创新项目等,提升个人职业发展路径。
"""
print(f"response:{response}")
@misc{shi2024industryinstruction,
title = {IndustryInstruction},
author = {Xiaofeng Shi and Lulu Zhao and Hua Zhou and Donglin Hao and Yonghua Lin},
year = {2024},
publisher = {Hugging Face},
doi = {10.57967/hf/3487},
url = {https://huggingface.co/datasets/BAAI/IndustryInstruction}
}