Instructions to use arcee-ai/AFM-4.5B-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use arcee-ai/AFM-4.5B-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="arcee-ai/AFM-4.5B-Preview") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("arcee-ai/AFM-4.5B-Preview") model = AutoModelForCausalLM.from_pretrained("arcee-ai/AFM-4.5B-Preview") 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 arcee-ai/AFM-4.5B-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "arcee-ai/AFM-4.5B-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "arcee-ai/AFM-4.5B-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/arcee-ai/AFM-4.5B-Preview
- SGLang
How to use arcee-ai/AFM-4.5B-Preview 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 "arcee-ai/AFM-4.5B-Preview" \ --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": "arcee-ai/AFM-4.5B-Preview", "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 "arcee-ai/AFM-4.5B-Preview" \ --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": "arcee-ai/AFM-4.5B-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use arcee-ai/AFM-4.5B-Preview with Docker Model Runner:
docker model run hf.co/arcee-ai/AFM-4.5B-Preview
Upload folder using huggingface_hub
Browse files- config.json +1 -6
- generation_config.json +1 -1
- model.safetensors.index.json +1 -0
- tokenizer_config.json +1 -2
config.json
CHANGED
|
@@ -4,11 +4,6 @@
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
-
"auto_map": {
|
| 8 |
-
"AutoConfig": "MaziyarPanahi/afm-sage-v8.4--configuration_arcee.ArceeConfig",
|
| 9 |
-
"AutoModel": "MaziyarPanahi/afm-sage-v8.4--modeling_arcee.ArceeForCausalLM",
|
| 10 |
-
"AutoModelForCausalLM": "MaziyarPanahi/afm-sage-v8.4--modeling_arcee.ArceeForCausalLM"
|
| 11 |
-
},
|
| 12 |
"bos_token_id": 128000,
|
| 13 |
"eos_token_id": 128003,
|
| 14 |
"head_dim": 128,
|
|
@@ -35,7 +30,7 @@
|
|
| 35 |
"rope_theta": 10000.0,
|
| 36 |
"tie_word_embeddings": false,
|
| 37 |
"torch_dtype": "bfloat16",
|
| 38 |
-
"transformers_version": "4.
|
| 39 |
"use_cache": false,
|
| 40 |
"vocab_size": 128064
|
| 41 |
}
|
|
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
"bos_token_id": 128000,
|
| 8 |
"eos_token_id": 128003,
|
| 9 |
"head_dim": 128,
|
|
|
|
| 30 |
"rope_theta": 10000.0,
|
| 31 |
"tie_word_embeddings": false,
|
| 32 |
"torch_dtype": "bfloat16",
|
| 33 |
+
"transformers_version": "4.54.1",
|
| 34 |
"use_cache": false,
|
| 35 |
"vocab_size": 128064
|
| 36 |
}
|
generation_config.json
CHANGED
|
@@ -2,6 +2,6 @@
|
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 128000,
|
| 4 |
"eos_token_id": 128003,
|
| 5 |
-
"transformers_version": "4.
|
| 6 |
"use_cache": false
|
| 7 |
}
|
|
|
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 128000,
|
| 4 |
"eos_token_id": 128003,
|
| 5 |
+
"transformers_version": "4.54.1",
|
| 6 |
"use_cache": false
|
| 7 |
}
|
model.safetensors.index.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
|
|
|
| 3 |
"total_size": 9238983680
|
| 4 |
},
|
| 5 |
"weight_map": {
|
|
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
+
"total_parameters": 4619491840,
|
| 4 |
"total_size": 9238983680
|
| 5 |
},
|
| 6 |
"weight_map": {
|
tokenizer_config.json
CHANGED
|
@@ -42,7 +42,6 @@
|
|
| 42 |
}
|
| 43 |
},
|
| 44 |
"bos_token": "<|begin_of_text|>",
|
| 45 |
-
"chat_template": "{{ bos_token }}{%- set loop_messages = messages %}\n{%- if loop_messages[0]['role'] != 'system' %}\n<|im_start|>system\nYou are a helpful assistant named AFM-4.5B-Preview, trained by Arcee AI.<|im_end|>\n{%- endif %}\n{%- for message in loop_messages %}\n{%- set content = '<|im_start|>' + message['role'] + '\\n'+ message['content'] | trim %}\n{%- if loop.index0 == 0 %}\n{%- set content = content %}\n{%- endif %}\n{%- if not (loop.last and message['role'] == 'assistant') %}\n{%- set content = content + '<|im_end|>\\n' %}\n{%- endif %}\n{{- content }}\n{%- endfor %}\n{%- if messages[-1]['role'] != 'assistant' %}\n{{- '<|im_start|>assistant\\n' }}\n{%- endif %}",
|
| 46 |
"clean_up_tokenization_spaces": true,
|
| 47 |
"eos_token": "<|end_of_text|>",
|
| 48 |
"extra_special_tokens": {},
|
|
@@ -53,5 +52,5 @@
|
|
| 53 |
"model_max_length": 65536,
|
| 54 |
"pad_token": "<|finetune_right_pad_id|>",
|
| 55 |
"padding_side": "left",
|
| 56 |
-
"tokenizer_class": "
|
| 57 |
}
|
|
|
|
| 42 |
}
|
| 43 |
},
|
| 44 |
"bos_token": "<|begin_of_text|>",
|
|
|
|
| 45 |
"clean_up_tokenization_spaces": true,
|
| 46 |
"eos_token": "<|end_of_text|>",
|
| 47 |
"extra_special_tokens": {},
|
|
|
|
| 52 |
"model_max_length": 65536,
|
| 53 |
"pad_token": "<|finetune_right_pad_id|>",
|
| 54 |
"padding_side": "left",
|
| 55 |
+
"tokenizer_class": "PreTrainedTokenizerFast"
|
| 56 |
}
|