Text Generation
Transformers
Safetensors
Chinese
English
tensormind
causal-lm
chinese
custom-code
conversational
custom_code
Eval Results (legacy)
Instructions to use TensorMind/TensorMind-0.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TensorMind/TensorMind-0.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TensorMind/TensorMind-0.5B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TensorMind/TensorMind-0.5B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TensorMind/TensorMind-0.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TensorMind/TensorMind-0.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TensorMind/TensorMind-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TensorMind/TensorMind-0.5B
- SGLang
How to use TensorMind/TensorMind-0.5B 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 "TensorMind/TensorMind-0.5B" \ --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": "TensorMind/TensorMind-0.5B", "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 "TensorMind/TensorMind-0.5B" \ --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": "TensorMind/TensorMind-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TensorMind/TensorMind-0.5B with Docker Model Runner:
docker model run hf.co/TensorMind/TensorMind-0.5B
| # Copyright 2026 The TensorMind team. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| """TensorMind model configuration""" | |
| try: | |
| from transformers.configuration_utils import PreTrainedConfig | |
| from transformers.modeling_rope_utils import RopeParameters | |
| except ImportError: | |
| from transformers.configuration_utils import PretrainedConfig as PreTrainedConfig | |
| RopeParameters = None | |
| class TensorMindConfig(PreTrainedConfig): | |
| model_type = "tensormind" | |
| keys_to_ignore_at_inference = ["past_key_values"] | |
| base_model_tp_plan = { | |
| "layers.*.self_attn.q_proj": "colwise", | |
| "layers.*.self_attn.k_proj": "colwise", | |
| "layers.*.self_attn.v_proj": "colwise", | |
| "layers.*.self_attn.o_proj": "rowwise", | |
| "layers.*.mlp.gate_proj": "colwise", | |
| "layers.*.mlp.up_proj": "colwise", | |
| "layers.*.mlp.down_proj": "rowwise", | |
| } | |
| base_model_pp_plan = { | |
| "embed_tokens": (["input_ids"], ["inputs_embeds"]), | |
| "layers": (["hidden_states", "attention_mask"], ["hidden_states"]), | |
| "norm": (["hidden_states"], ["hidden_states"]), | |
| } | |
| def __init__( | |
| self, | |
| vocab_size: int | None = 32768, | |
| hidden_size: int | None = 1024, | |
| intermediate_size: int | None = 4096, | |
| num_hidden_layers: int | None = 32, | |
| num_attention_heads: int | None = 16, | |
| num_key_value_heads: int | None = 8, | |
| hidden_act: str | None = "silu", | |
| max_position_embeddings: int | None = 32768, | |
| initializer_range: float | None = 0.02, | |
| rms_norm_eps: int | None = 1e-6, | |
| use_cache: bool | None = True, | |
| tie_word_embeddings: bool | None = True, | |
| attention_bias: bool | None = False, | |
| attention_dropout: float | None = 0.0, | |
| pad_token_id: int | None = None, | |
| bos_token_id: int | None = None, | |
| eos_token_id: int | None = None, | |
| rope_parameters: RopeParameters | dict[str, RopeParameters] | None = { | |
| "rope_type": "default", | |
| "rope_theta": 10000.0, | |
| # YaRN | |
| # "factor": 4.0, | |
| # "original_max_position_embeddings": 32768, | |
| # "attention_factor": 1.0, | |
| # "beta_fast": 32.0, | |
| # "beta_slow": 1.0, | |
| }, | |
| **kwargs, | |
| ): | |
| self.vocab_size = vocab_size | |
| self.max_position_embeddings = max_position_embeddings | |
| 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.num_key_value_heads = num_key_value_heads | |
| self.hidden_act = hidden_act | |
| self.initializer_range = initializer_range | |
| self.rms_norm_eps = rms_norm_eps | |
| self.use_cache = use_cache | |
| self.attention_bias = attention_bias | |
| self.attention_dropout = attention_dropout | |
| self.rope_parameters = rope_parameters | |
| self.tie_word_embeddings = tie_word_embeddings | |
| self.pad_token_id = pad_token_id | |
| self.bos_token_id = bos_token_id | |
| self.eos_token_id = eos_token_id | |
| self._attn_implementation = "sdpa" | |
| super().__init__(**kwargs) | |
| __all__ = ["TensorMindConfig"] | |