Instructions to use echo840/Monkey with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use echo840/Monkey with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="echo840/Monkey", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("echo840/Monkey", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use echo840/Monkey with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "echo840/Monkey" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "echo840/Monkey", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/echo840/Monkey
- SGLang
How to use echo840/Monkey 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 "echo840/Monkey" \ --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": "echo840/Monkey", "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 "echo840/Monkey" \ --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": "echo840/Monkey", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use echo840/Monkey with Docker Model Runner:
docker model run hf.co/echo840/Monkey
| # Copyright (c) Alibaba Cloud. | |
| # | |
| # This source code is licensed under the license found in the | |
| # LICENSE file in the root directory of this source tree. | |
| from transformers import PretrainedConfig | |
| class MonkeyConfig(PretrainedConfig): | |
| model_type = "monkey" | |
| keys_to_ignore_at_inference = ["past_key_values"] | |
| def __init__( | |
| self, | |
| vocab_size=151936, | |
| hidden_size=4096, | |
| num_hidden_layers=32, | |
| num_attention_heads=32, | |
| emb_dropout_prob=0.0, | |
| attn_dropout_prob=0.0, | |
| layer_norm_epsilon=1e-6, | |
| initializer_range=0.02, | |
| max_position_embeddings=8192, | |
| scale_attn_weights=True, | |
| use_cache=True, | |
| bf16=False, | |
| fp16=False, | |
| fp32=False, | |
| kv_channels=128, | |
| rotary_pct=1.0, | |
| rotary_emb_base=10000, | |
| use_dynamic_ntk=True, | |
| use_logn_attn=True, | |
| use_flash_attn="auto", | |
| intermediate_size=22016, | |
| no_bias=True, | |
| tie_word_embeddings=False, | |
| **kwargs, | |
| ): | |
| self.vocab_size = vocab_size | |
| self.hidden_size = hidden_size | |
| self.intermediate_size = intermediate_size | |
| self.num_hidden_layers = num_hidden_layers | |
| self.num_attention_heads = num_attention_heads | |
| self.emb_dropout_prob = emb_dropout_prob | |
| self.attn_dropout_prob = attn_dropout_prob | |
| self.layer_norm_epsilon = layer_norm_epsilon | |
| self.initializer_range = initializer_range | |
| self.scale_attn_weights = scale_attn_weights | |
| self.use_cache = use_cache | |
| self.max_position_embeddings = max_position_embeddings | |
| self.bf16 = bf16 | |
| self.fp16 = fp16 | |
| self.fp32 = fp32 | |
| self.kv_channels = kv_channels | |
| self.rotary_pct = rotary_pct | |
| self.rotary_emb_base = rotary_emb_base | |
| self.use_dynamic_ntk = use_dynamic_ntk | |
| self.use_logn_attn = use_logn_attn | |
| self.use_flash_attn = use_flash_attn | |
| self.no_bias = no_bias | |
| super().__init__( | |
| tie_word_embeddings=tie_word_embeddings, | |
| **kwargs | |
| ) | |