Instructions to use Ian-14/model_test with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ian-14/model_test with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ian-14/model_test", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Ian-14/model_test", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Ian-14/model_test with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ian-14/model_test" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ian-14/model_test", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Ian-14/model_test
- SGLang
How to use Ian-14/model_test 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 "Ian-14/model_test" \ --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": "Ian-14/model_test", "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 "Ian-14/model_test" \ --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": "Ian-14/model_test", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Ian-14/model_test with Docker Model Runner:
docker model run hf.co/Ian-14/model_test
| pipeline_tag: text-generation | |
| license: apache-2.0 | |
| language: | |
| - zh | |
| widget: | |
| - text: "你好啊,O(∩_∩)O哈哈~" | |
| example_title: "Sentiment analysis" | |
| - text: "Barack Obama nominated Hilary Clinton as his secretary of state on Monday. He chose her because she had ..." | |
| example_title: "向量化" | |
| - text: "On a shelf, there are five books: a gray book, a red book, a purple book, a blue book, and a black book ..." | |
| example_title: "Logic puzzles" | |
| - text: "The two men running to become New York City's next mayor will face off in their first debate Wednesday night ..." | |
| example_title: "Reading comprehension" | |
| ### How to use | |
| ```python | |
| from transformers import AutoTokenizer, AutoModel | |
| tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm2-6b-int4", trust_remote_code=True) | |
| model = AutoModel.from_pretrained("THUDM/chatglm2-6b-int4", trust_remote_code=True).half().cuda() | |
| model = model.eval() | |
| text = "你好" | |
| response, history = model.chat(tokenizer, text, history=[]) | |
| response | |
| ``` |