Instructions to use HCCL-NLP/Zhiyin-7B-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HCCL-NLP/Zhiyin-7B-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HCCL-NLP/Zhiyin-7B-Chat", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("HCCL-NLP/Zhiyin-7B-Chat", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use HCCL-NLP/Zhiyin-7B-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HCCL-NLP/Zhiyin-7B-Chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HCCL-NLP/Zhiyin-7B-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HCCL-NLP/Zhiyin-7B-Chat
- SGLang
How to use HCCL-NLP/Zhiyin-7B-Chat 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 "HCCL-NLP/Zhiyin-7B-Chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HCCL-NLP/Zhiyin-7B-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "HCCL-NLP/Zhiyin-7B-Chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HCCL-NLP/Zhiyin-7B-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HCCL-NLP/Zhiyin-7B-Chat with Docker Model Runner:
docker model run hf.co/HCCL-NLP/Zhiyin-7B-Chat
YAML Metadata Warning:The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
知音聊天机器人由中科院声学所语音与智能信息处理实验室研发,用于回答用户问题和提供信息,以帮助人们解决问题和获取知识。本项目后续会开放指令训练数据、相关模型、训练代码、应用场景等。
Python使用范例/Quick Start
>>> import torch
>>> from transformers.generation.utils import GenerationConfig
>>> from transformers import AutoModelForCausalLM, AutoTokenizer
>>> model_dir='HCCL-NLP/Zhiyin-7B-Chat'#离线使用时改为模型储存路径
>>> tokenizer = AutoTokenizer.from_pretrained(model_dir, use_fast=False, trust_remote_code=True)
>>> model = AutoModelForCausalLM.from_pretrained(model_dir, device_map='auto', torch_dtype=torch.bfloat16, trust_remote_code=True)
>>> model.generation_config = GenerationConfig.from_pretrained(model_dir)
>>> messages = []
>>> messages.append({"role": "user", "content": "诸葛亮北伐失败的原因"})
>>> response = model.chat(tokenizer, messages)
>>> print(response)
诸葛亮北伐失败的原因有很多,以下是一些主要因素:
1. 资源不足:尽管蜀国在诸葛亮的领导下进行了积极的备战,但与强大的魏国相比,其资源和实力仍然相差甚远。
2. 地理劣势:魏国占据着中原地区,地势平坦、易守难攻;而蜀国则地处西南,地势险要但运输困难。
3. 战略失误:诸葛亮北伐时,曾试图攻打魏国的首都洛阳,但这一战略被许多历史学家认为是错误的,因为这样会陷入敌人的腹地,难以持。
4. 人才流失:蜀国在诸葛亮北伐期间,人才流失严重,尤其是蜀汉的精英将领和士兵,这大大削弱了蜀国的实力。
5. 时间有限:诸葛亮北伐的时间有限,他在五丈原与司马懿相持数月后,因病去世,北伐计划被迫中止。
6. 内部矛盾:蜀国内部存在一定的矛盾和冲突,如诸葛亮与李严的关系紧张等,这些矛盾对北伐产生了一定的影响。
- Downloads last month
- 6