Instructions to use ecnu-icalk/educhat-base-002-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ecnu-icalk/educhat-base-002-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ecnu-icalk/educhat-base-002-7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ecnu-icalk/educhat-base-002-7b") model = AutoModelForCausalLM.from_pretrained("ecnu-icalk/educhat-base-002-7b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ecnu-icalk/educhat-base-002-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ecnu-icalk/educhat-base-002-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ecnu-icalk/educhat-base-002-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ecnu-icalk/educhat-base-002-7b
- SGLang
How to use ecnu-icalk/educhat-base-002-7b 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 "ecnu-icalk/educhat-base-002-7b" \ --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": "ecnu-icalk/educhat-base-002-7b", "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 "ecnu-icalk/educhat-base-002-7b" \ --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": "ecnu-icalk/educhat-base-002-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ecnu-icalk/educhat-base-002-7b with Docker Model Runner:
docker model run hf.co/ecnu-icalk/educhat-base-002-7b
使用方法
本模型使用educhat-sft-002-data-osm数据,从BELLE训练得到,由于LLaMA对其衍生模型的限制,发布的权重只能包含差异部分,使用前请先按照以下流程转换权重。
Step1:将原始LLaMA权重转换为huggingface版本。
首先下载LLaMA原始权重,然后使用权重转换脚本转换权重。
python src/transformers/models/llama/convert_llama_weights_to_hf.py \
--input_dir /path/to/downloaded/llama/weights --model_size 7B --output_dir /output/LLaMA_hf/7B
Step2:使用解密脚本将增量权重加到原始LLaMA权重上。
python ./decrypt.py --base /path/to/LLAMA_hf/7B --target ./educhat-base-002-7b-decrypt --delta /path/to/educhat-base-002-7b
使用示例
转换权重后,使用示例请参考:https://github.com/icalk-nlp/EduChat#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B
- Downloads last month
- 14