Text Generation
Transformers
Safetensors
English
flex_olmo
Mixture of Experts
olmo
flexolmo
conversational
Instructions to use allenai/Flex-code-2x7B-1T with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use allenai/Flex-code-2x7B-1T with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="allenai/Flex-code-2x7B-1T") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("allenai/Flex-code-2x7B-1T") model = AutoModelForCausalLM.from_pretrained("allenai/Flex-code-2x7B-1T", 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 allenai/Flex-code-2x7B-1T with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "allenai/Flex-code-2x7B-1T" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "allenai/Flex-code-2x7B-1T", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/allenai/Flex-code-2x7B-1T
- SGLang
How to use allenai/Flex-code-2x7B-1T 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 "allenai/Flex-code-2x7B-1T" \ --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": "allenai/Flex-code-2x7B-1T", "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 "allenai/Flex-code-2x7B-1T" \ --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": "allenai/Flex-code-2x7B-1T", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use allenai/Flex-code-2x7B-1T with Docker Model Runner:
docker model run hf.co/allenai/Flex-code-2x7B-1T
Update README.md
Browse files
README.md
CHANGED
|
@@ -58,8 +58,8 @@ print(tokenizer.decode(out[0]))
|
|
| 58 |
| Reddit | 64.7 | 36.5 | 56.1 | 25.5 | 35.5 | 19.7 | 2.5 | 54.1 | 8.6 | 32.7 | 1.7 | 30.7 |
|
| 59 |
| **Combined** |
|
| 60 |
| BTM (top-2) | 68.7 | 57.7 | 59.4 | 28.3 | 43.2 | 44.3 | 23.1 | 73.6 | 54.4 | 46.3 | **24.0** | 47.6 |
|
| 61 |
-
|
|
| 62 |
-
| **FlexOlmo-7x7B-1T-RT** | 70.
|
| 63 |
|
| 64 |
* The evaluation of the individual model refers to the dense model, not the 2x7B MoE model.
|
| 65 |
|
|
|
|
| 58 |
| Reddit | 64.7 | 36.5 | 56.1 | 25.5 | 35.5 | 19.7 | 2.5 | 54.1 | 8.6 | 32.7 | 1.7 | 30.7 |
|
| 59 |
| **Combined** |
|
| 60 |
| BTM (top-2) | 68.7 | 57.7 | 59.4 | 28.3 | 43.2 | 44.3 | 23.1 | 73.6 | 54.4 | 46.3 | **24.0** | 47.6 |
|
| 61 |
+
| **FlexOlmo-7x7B-1T** | 65.6 | 44.7 | 50.9 | 22.1 | 37.2 | 35.6 | 25.4 | 55.8 | 39.0 | 45.9 | 10.6 | 39.3 |
|
| 62 |
+
| **FlexOlmo-7x7B-1T-RT** | **70.6** | **59.7** | **60.0** | **30.5** | **44.6** | **45.9** | 47.7 | **79.7** | **67.6** | **54.5** | 11.3 | **52.0** |
|
| 63 |
|
| 64 |
* The evaluation of the individual model refers to the dense model, not the 2x7B MoE model.
|
| 65 |
|