Instructions to use Dimensity/Complexity-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Dimensity/Complexity-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Dimensity/Complexity-1B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Dimensity/Complexity-1B") model = AutoModelForCausalLM.from_pretrained("Dimensity/Complexity-1B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Dimensity/Complexity-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Dimensity/Complexity-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dimensity/Complexity-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Dimensity/Complexity-1B
- SGLang
How to use Dimensity/Complexity-1B 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 "Dimensity/Complexity-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dimensity/Complexity-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Dimensity/Complexity-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dimensity/Complexity-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Dimensity/Complexity-1B with Docker Model Runner:
docker model run hf.co/Dimensity/Complexity-1B
| license: mit | |
| tags: | |
| - code | |
| widget: | |
| - text: "print(" | |
| example_title: "Example 1" | |
| - text: "def calculate" | |
| example_title: "Example 2" | |
| ```Complexity-1B``` | |
| # Model Details | |
| Complexity-1B is a finetuned version of the GPT-NeoX 1.3B model [@gpt-neox] for code completion tasks. It was finetuned on a dataset of Python code from open source projects on GitHub. | |
| # Intended Uses | |
| This model is intended to be used for code completion in Python. It can suggest likely completions for partially written Python code. | |
| # Evaluation Data | |
| The model was evaluated on a holdout set from the training data distribution, containing Python code snippets. | |
| # Metrics | |
| The primary evaluation metric was accuracy of code completion on the evaluation set. The model achieves 49% accuracy on code completion. | |
| # Ethical Considerations | |
| The training data contains code from public GitHub repositories. Care should be taken to avoid completing code in unethical or harmful ways not intended by the original developers. | |
| # Caveats and Recommendations | |
| The model is designed for Python code completion only. Performance on other programming languages is unknown. Users should carefully validate any generated code before executing or deploying it. |