Text Generation
Transformers
Safetensors
English
Chinese
qwen3
conversational
text-generation-inference
Instructions to use MemTensor/MemOperator-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MemTensor/MemOperator-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MemTensor/MemOperator-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MemTensor/MemOperator-4B") model = AutoModelForCausalLM.from_pretrained("MemTensor/MemOperator-4B") 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 MemTensor/MemOperator-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MemTensor/MemOperator-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MemTensor/MemOperator-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MemTensor/MemOperator-4B
- SGLang
How to use MemTensor/MemOperator-4B 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 "MemTensor/MemOperator-4B" \ --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": "MemTensor/MemOperator-4B", "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 "MemTensor/MemOperator-4B" \ --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": "MemTensor/MemOperator-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MemTensor/MemOperator-4B with Docker Model Runner:
docker model run hf.co/MemTensor/MemOperator-4B
Update README.md
Browse files
README.md
CHANGED
|
@@ -60,7 +60,6 @@ Memory Operator is optimized for fast and accurate memory handling, enabling rea
|
|
| 60 |
| **MemOperator-1.7B** | **0.7571** | **0.8068** | **0.6560** | **0.7955** | **0.5521** |
|
| 61 |
| **MemOperator-0.6B** | **0.6753** | **0.6635** | **0.5780** | **0.7325** | **0.5000** |
|
| 62 |
| GPT-4o-mini | 0.7405 | 0.7217 | 0.6844 | 0.7864 | 0.5659 |
|
| 63 |
-
| Qwen3-8B | 0.6994 | 0.4984 | 0.7092 | 0.7943 | 0.5104 |
|
| 64 |
|
| 65 |
> ✅ **Key Advantage**:
|
| 66 |
> By replacing large open-source models (e.g., Qwen3-32B) with **MemOperator-4B**, you can achieve **comparable or better memory processing performance** while reducing **resource consumption by over 80%** (4B vs 32B). This enables efficient, scalable, and cost-effective deployment.
|
|
@@ -93,6 +92,7 @@ config = SimpleStructMemReaderConfig(
|
|
| 93 |
"max_tokens": 6000,
|
| 94 |
"top_p": 0.95,
|
| 95 |
"top_k": 20,
|
|
|
|
| 96 |
},
|
| 97 |
},
|
| 98 |
"embedder": {
|
|
|
|
| 60 |
| **MemOperator-1.7B** | **0.7571** | **0.8068** | **0.6560** | **0.7955** | **0.5521** |
|
| 61 |
| **MemOperator-0.6B** | **0.6753** | **0.6635** | **0.5780** | **0.7325** | **0.5000** |
|
| 62 |
| GPT-4o-mini | 0.7405 | 0.7217 | 0.6844 | 0.7864 | 0.5659 |
|
|
|
|
| 63 |
|
| 64 |
> ✅ **Key Advantage**:
|
| 65 |
> By replacing large open-source models (e.g., Qwen3-32B) with **MemOperator-4B**, you can achieve **comparable or better memory processing performance** while reducing **resource consumption by over 80%** (4B vs 32B). This enables efficient, scalable, and cost-effective deployment.
|
|
|
|
| 92 |
"max_tokens": 6000,
|
| 93 |
"top_p": 0.95,
|
| 94 |
"top_k": 20,
|
| 95 |
+
"extra_body": {"chat_template_kwargs": {"enable_thinking": false}}
|
| 96 |
},
|
| 97 |
},
|
| 98 |
"embedder": {
|