Instructions to use maywell/Qwen2-7B-Multilingual-RP with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use maywell/Qwen2-7B-Multilingual-RP with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="maywell/Qwen2-7B-Multilingual-RP") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("maywell/Qwen2-7B-Multilingual-RP") model = AutoModelForCausalLM.from_pretrained("maywell/Qwen2-7B-Multilingual-RP") 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use maywell/Qwen2-7B-Multilingual-RP with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "maywell/Qwen2-7B-Multilingual-RP" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "maywell/Qwen2-7B-Multilingual-RP", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/maywell/Qwen2-7B-Multilingual-RP
- SGLang
How to use maywell/Qwen2-7B-Multilingual-RP 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 "maywell/Qwen2-7B-Multilingual-RP" \ --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": "maywell/Qwen2-7B-Multilingual-RP", "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 "maywell/Qwen2-7B-Multilingual-RP" \ --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": "maywell/Qwen2-7B-Multilingual-RP", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use maywell/Qwen2-7B-Multilingual-RP with Docker Model Runner:
docker model run hf.co/maywell/Qwen2-7B-Multilingual-RP
Delete .ipynb_checkpoints
#1
by maywell - opened
.ipynb_checkpoints/config-checkpoint.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"_name_or_path": "maywell/Qwen2-7B-Multilingual-RP",
|
| 3 |
-
"architectures": [
|
| 4 |
-
"Qwen2ForCausalLM"
|
| 5 |
-
],
|
| 6 |
-
"attention_dropout": 0.0,
|
| 7 |
-
"eos_token_id": 151645,
|
| 8 |
-
"hidden_act": "silu",
|
| 9 |
-
"hidden_size": 3584,
|
| 10 |
-
"initializer_range": 0.02,
|
| 11 |
-
"intermediate_size": 18944,
|
| 12 |
-
"max_position_embeddings": 32768,
|
| 13 |
-
"max_window_layers": 28,
|
| 14 |
-
"model_type": "qwen2",
|
| 15 |
-
"num_attention_heads": 28,
|
| 16 |
-
"num_hidden_layers": 28,
|
| 17 |
-
"num_key_value_heads": 4,
|
| 18 |
-
"rms_norm_eps": 1e-06,
|
| 19 |
-
"rope_theta": 1000000.0,
|
| 20 |
-
"sliding_window": 131072,
|
| 21 |
-
"tie_word_embeddings": false,
|
| 22 |
-
"torch_dtype": "bfloat16",
|
| 23 |
-
"transformers_version": "4.41.2",
|
| 24 |
-
"use_cache": false,
|
| 25 |
-
"use_sliding_window": false,
|
| 26 |
-
"vocab_size": 152064
|
| 27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ipynb_checkpoints/tokenizer_config-checkpoint.json
DELETED
|
@@ -1,43 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"add_prefix_space": false,
|
| 3 |
-
"added_tokens_decoder": {
|
| 4 |
-
"151643": {
|
| 5 |
-
"content": "<|endoftext|>",
|
| 6 |
-
"lstrip": false,
|
| 7 |
-
"normalized": false,
|
| 8 |
-
"rstrip": false,
|
| 9 |
-
"single_word": false,
|
| 10 |
-
"special": true
|
| 11 |
-
},
|
| 12 |
-
"151644": {
|
| 13 |
-
"content": "<|im_start|>",
|
| 14 |
-
"lstrip": false,
|
| 15 |
-
"normalized": false,
|
| 16 |
-
"rstrip": false,
|
| 17 |
-
"single_word": false,
|
| 18 |
-
"special": true
|
| 19 |
-
},
|
| 20 |
-
"151645": {
|
| 21 |
-
"content": "<|im_end|>",
|
| 22 |
-
"lstrip": false,
|
| 23 |
-
"normalized": false,
|
| 24 |
-
"rstrip": false,
|
| 25 |
-
"single_word": false,
|
| 26 |
-
"special": true
|
| 27 |
-
}
|
| 28 |
-
},
|
| 29 |
-
"additional_special_tokens": [
|
| 30 |
-
"<|im_start|>",
|
| 31 |
-
"<|im_end|>"
|
| 32 |
-
],
|
| 33 |
-
"bos_token": null,
|
| 34 |
-
"chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content']}}{% if not loop.last or (loop.last and message['role'] != 'assistant') %}{{'<|im_end|>\n'}}{% endif %}{% endfor %}{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{ '<|im_start|>assistant\n' }}{% endif %}",
|
| 35 |
-
"clean_up_tokenization_spaces": false,
|
| 36 |
-
"eos_token": "<|im_end|>",
|
| 37 |
-
"errors": "replace",
|
| 38 |
-
"model_max_length": 131072,
|
| 39 |
-
"pad_token": "<|endoftext|>",
|
| 40 |
-
"split_special_tokens": false,
|
| 41 |
-
"tokenizer_class": "Qwen2Tokenizer",
|
| 42 |
-
"unk_token": null
|
| 43 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|