Text Generation
Transformers
Safetensors
qwen2
mergekit
Merge
conversational
text-generation-inference
Instructions to use hellohle/imlong with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hellohle/imlong with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hellohle/imlong") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hellohle/imlong") model = AutoModelForCausalLM.from_pretrained("hellohle/imlong", device_map="auto") 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 Settings
- vLLM
How to use hellohle/imlong with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hellohle/imlong" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hellohle/imlong", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/hellohle/imlong
- SGLang
How to use hellohle/imlong 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 "hellohle/imlong" \ --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": "hellohle/imlong", "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 "hellohle/imlong" \ --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": "hellohle/imlong", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use hellohle/imlong with Docker Model Runner:
docker model run hf.co/hellohle/imlong
Update config.json
Browse files- config.json +25 -30
config.json
CHANGED
|
@@ -1,34 +1,29 @@
|
|
| 1 |
{
|
| 2 |
-
"architectures": [
|
| 3 |
-
"LlamaForCausalLM"
|
| 4 |
-
],
|
| 5 |
-
"attention_bias": false,
|
| 6 |
-
"attention_dropout": 0.0,
|
| 7 |
-
"bos_token_id": 32013,
|
| 8 |
-
"dtype": "float16",
|
| 9 |
-
"eos_token_id": 32021,
|
| 10 |
-
"head_dim": 128,
|
| 11 |
-
"hidden_act": "silu",
|
| 12 |
-
"hidden_size": 4096,
|
| 13 |
-
"initializer_range": 0.02,
|
| 14 |
-
"intermediate_size": 11008,
|
| 15 |
-
"max_position_embeddings": 16384,
|
| 16 |
-
"mlp_bias": false,
|
| 17 |
"model_type": "llama",
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
"num_hidden_layers": 28,
|
| 20 |
-
|
| 21 |
-
"
|
| 22 |
-
|
| 23 |
-
"
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
"tie_word_embeddings": false,
|
| 31 |
-
|
| 32 |
-
"
|
| 33 |
-
"
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
{
|
| 2 |
+
"architectures": ["LlamaForCausalLM"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"model_type": "llama",
|
| 4 |
+
|
| 5 |
+
"hidden_size": 3584,
|
| 6 |
+
"intermediate_size": 14336,
|
| 7 |
+
|
| 8 |
+
"num_attention_heads": 28,
|
| 9 |
+
"num_key_value_heads": 28,
|
| 10 |
"num_hidden_layers": 28,
|
| 11 |
+
|
| 12 |
+
"vocab_size": 152064,
|
| 13 |
+
|
| 14 |
+
"max_position_embeddings": 16384,
|
| 15 |
+
|
| 16 |
+
"hidden_act": "silu",
|
| 17 |
+
"initializer_range": 0.02,
|
| 18 |
+
|
| 19 |
+
"rms_norm_eps": 1e-6,
|
| 20 |
+
|
| 21 |
"tie_word_embeddings": false,
|
| 22 |
+
|
| 23 |
+
"bos_token_id": 32013,
|
| 24 |
+
"eos_token_id": 32021,
|
| 25 |
+
|
| 26 |
+
"rope_theta": 100000,
|
| 27 |
+
|
| 28 |
+
"use_cache": true
|
| 29 |
+
}
|