Run this model with HF Jobs
Run XiaofengAlg/Automobile-llama3_1_8B_instruct on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/XiaofengAlg/Automobile-llama3_1_8B_instruct. Ask me which dataset to train on, then push the fine-tuned model to a new private model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/XiaofengAlg/Automobile-llama3_1_8B_instruct on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/XiaofengAlg/Automobile-llama3_1_8B_instruct. Ask me which benchmark to run, then save the scores and the per-example results to a new private dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/XiaofengAlg/Automobile-llama3_1_8B_instruct. Push it to a new private model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use XiaofengAlg/Automobile-llama3_1_8B_instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use XiaofengAlg/Automobile-llama3_1_8B_instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="XiaofengAlg/Automobile-llama3_1_8B_instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("XiaofengAlg/Automobile-llama3_1_8B_instruct") model = AutoModelForCausalLM.from_pretrained("XiaofengAlg/Automobile-llama3_1_8B_instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use XiaofengAlg/Automobile-llama3_1_8B_instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "XiaofengAlg/Automobile-llama3_1_8B_instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "XiaofengAlg/Automobile-llama3_1_8B_instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/XiaofengAlg/Automobile-llama3_1_8B_instruct
- SGLang
How to use XiaofengAlg/Automobile-llama3_1_8B_instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "XiaofengAlg/Automobile-llama3_1_8B_instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "XiaofengAlg/Automobile-llama3_1_8B_instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "XiaofengAlg/Automobile-llama3_1_8B_instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "XiaofengAlg/Automobile-llama3_1_8B_instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use XiaofengAlg/Automobile-llama3_1_8B_instruct with Docker Model Runner:
docker model run hf.co/XiaofengAlg/Automobile-llama3_1_8B_instruct
You need to agree to share your Hugging Face information to access this model
This repository is publicly accessible, but you have to accept the conditions to access its files and content.
You agree to not use the model to conduct experiments that cause harm to human subjects.
Log in or Sign Up to review the conditions and access this model content.
Automobile Llama-3.1-8B-Instruct
Domain-adapted instruction model for the automobile industry, fine-tuned from Meta-Llama-3.1-8B-Instruct on BAAI/IndustryInstruction_Automobiles. Part of the Industry-Domain LLMs collection.
This model is finetuned on the model llama3.1-8b-instruct using the dataset BAAI/IndustryInstruction_Automobiles dataset, the dataset details can jump to the repo: BAAI/IndustryInstruction
training params
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
evaluation
No standardized domain evaluation benchmark was available at release time; we recommend evaluating on your target domain tasks before deployment.
How to use
# !/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/Automobile-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}")
"""
传统车企应积极拥抱互联网和科技公司的挑战,加速向智能化、电动化的方向转型。首先,车企需要加强与科技公司的合作,利用其在人工智能、自动驾驶等领域的技术优势,提升自身产品的智能化水平。其次,车企应加大在电动化领域的投入,研发更多电动车型,满足市场对环保、节能的需求。同时,车企还应加强与电池供应商的合作,提升电动车的续航里程和充电速度,提高用户体验。此外,车企还应加强在智能互联方面的投入,提供更好的车联网服务,满足用户对智能化、便捷化的需求。总之,传统车企应积极应对互联网和科技公司的挑战,加速向智能化、电动化的方向转型,以适应市场的变化,保持竞争力
"""
Citation
@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}
}
Author & Links
- Homepage: Xiaofeng Shi (xiaofengshi.com)
- GitHub: github.com/xiaofengShi · Hugging Face: @XiaofengAlg
- ORCID: 0009-0009-6052-7713 · Google Scholar: Xiaofeng Shi
- Downloads last month
- 2
Model tree for XiaofengAlg/Automobile-llama3_1_8B_instruct
Base model
meta-llama/Llama-3.1-8B