Text Generation
Transformers
Safetensors
English
Chinese
llama
conversational
text-generation-inference
Instructions to use ekojs/internlm2-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ekojs/internlm2-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ekojs/internlm2-7b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ekojs/internlm2-7b") model = AutoModelForCausalLM.from_pretrained("ekojs/internlm2-7b") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ekojs/internlm2-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ekojs/internlm2-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ekojs/internlm2-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ekojs/internlm2-7b
- SGLang
How to use ekojs/internlm2-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 "ekojs/internlm2-7b" \ --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": "ekojs/internlm2-7b", "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 "ekojs/internlm2-7b" \ --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": "ekojs/internlm2-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ekojs/internlm2-7b with Docker Model Runner:
docker model run hf.co/ekojs/internlm2-7b
Update tokenizer_config.json
Browse files- tokenizer_config.json +57 -11
tokenizer_config.json
CHANGED
|
@@ -25,24 +25,70 @@
|
|
| 25 |
"rstrip": false,
|
| 26 |
"single_word": false,
|
| 27 |
"special": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
}
|
| 29 |
},
|
| 30 |
"auto_map": {
|
| 31 |
"AutoTokenizer": [
|
| 32 |
-
"
|
| 33 |
-
|
| 34 |
]
|
| 35 |
},
|
| 36 |
"bos_token": "<s>",
|
| 37 |
-
"
|
|
|
|
|
|
|
| 38 |
"eos_token": "</s>",
|
| 39 |
-
"legacy": true,
|
| 40 |
"model_max_length": 1000000000000000019884624838656,
|
| 41 |
"pad_token": "</s>",
|
| 42 |
-
"sp_model_kwargs":
|
| 43 |
-
"
|
| 44 |
-
"
|
| 45 |
-
|
| 46 |
-
"unk_token": "<unk>",
|
| 47 |
-
"use_default_system_prompt": false
|
| 48 |
-
}
|
|
|
|
| 25 |
"rstrip": false,
|
| 26 |
"single_word": false,
|
| 27 |
"special": true
|
| 28 |
+
},
|
| 29 |
+
"92538": {
|
| 30 |
+
"content": "<|plugin|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"92539": {
|
| 38 |
+
"content": "<|interpreter|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"92540": {
|
| 46 |
+
"content": "<|action_end|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"92541": {
|
| 54 |
+
"content": "<|action_start|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"92542": {
|
| 62 |
+
"content": "<|im_end|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"92543": {
|
| 70 |
+
"content": "<|im_start|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
}
|
| 77 |
},
|
| 78 |
"auto_map": {
|
| 79 |
"AutoTokenizer": [
|
| 80 |
+
"LlamaTokenizer",
|
| 81 |
+
"LlamaTokenizerFast"
|
| 82 |
]
|
| 83 |
},
|
| 84 |
"bos_token": "<s>",
|
| 85 |
+
"chat_template": "{{ bos_token }}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
|
| 86 |
+
"clean_up_tokenization_spaces": false,
|
| 87 |
+
"decode_with_prefix_space": false,
|
| 88 |
"eos_token": "</s>",
|
|
|
|
| 89 |
"model_max_length": 1000000000000000019884624838656,
|
| 90 |
"pad_token": "</s>",
|
| 91 |
+
"sp_model_kwargs": null,
|
| 92 |
+
"tokenizer_class": "LlamaTokenizerFast",
|
| 93 |
+
"unk_token": "<unk>"
|
| 94 |
+
}
|
|
|
|
|
|
|
|
|