Text Generation
Transformers
Safetensors
English
shivik_code
code
causal-lm
shivik
conversational
custom_code
Instructions to use theaicompany02/Shivik-Code-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use theaicompany02/Shivik-Code-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="theaicompany02/Shivik-Code-1B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("theaicompany02/Shivik-Code-1B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use theaicompany02/Shivik-Code-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "theaicompany02/Shivik-Code-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "theaicompany02/Shivik-Code-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/theaicompany02/Shivik-Code-1B
- SGLang
How to use theaicompany02/Shivik-Code-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 "theaicompany02/Shivik-Code-1B" \ --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": "theaicompany02/Shivik-Code-1B", "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 "theaicompany02/Shivik-Code-1B" \ --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": "theaicompany02/Shivik-Code-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use theaicompany02/Shivik-Code-1B with Docker Model Runner:
docker model run hf.co/theaicompany02/Shivik-Code-1B
| """ | |
| SHIVIK-Code Configuration | |
| Extends LlamaConfig for SHIVIK-Code specific settings. | |
| """ | |
| from transformers import LlamaConfig | |
| class ShivikCodeConfig(LlamaConfig): | |
| """ | |
| Configuration class for SHIVIK-Code. | |
| Extends LlamaConfig with: | |
| - Extended context length defaults | |
| - Tool token configuration | |
| - FIM token configuration | |
| """ | |
| model_type = "shivik_code" | |
| def __init__( | |
| self, | |
| vocab_size=128279, | |
| hidden_size=2048, | |
| intermediate_size=8192, | |
| num_hidden_layers=16, | |
| num_attention_heads=32, | |
| num_key_value_heads=8, | |
| hidden_act="silu", | |
| max_position_embeddings=32768, | |
| initializer_range=0.02, | |
| rms_norm_eps=1e-5, | |
| use_cache=True, | |
| pad_token_id=None, | |
| bos_token_id=128000, | |
| eos_token_id=128001, | |
| tie_word_embeddings=False, | |
| rope_theta=500000.0, | |
| rope_scaling=None, | |
| attention_bias=False, | |
| attention_dropout=0.0, | |
| mlp_bias=False, | |
| # SHIVIK-Code specific | |
| tool_call_start_id=128256, | |
| tool_call_end_id=128257, | |
| tool_result_start_id=128258, | |
| tool_result_end_id=128259, | |
| fim_prefix_id=128276, | |
| fim_suffix_id=128277, | |
| fim_middle_id=128278, | |
| **kwargs, | |
| ): | |
| # Set YaRN scaling by default | |
| if rope_scaling is None: | |
| rope_scaling = { | |
| "type": "yarn", | |
| "factor": 8.0, | |
| "original_max_position_embeddings": 4096, | |
| } | |
| super().__init__( | |
| vocab_size=vocab_size, | |
| hidden_size=hidden_size, | |
| intermediate_size=intermediate_size, | |
| num_hidden_layers=num_hidden_layers, | |
| num_attention_heads=num_attention_heads, | |
| num_key_value_heads=num_key_value_heads, | |
| hidden_act=hidden_act, | |
| max_position_embeddings=max_position_embeddings, | |
| initializer_range=initializer_range, | |
| rms_norm_eps=rms_norm_eps, | |
| use_cache=use_cache, | |
| pad_token_id=pad_token_id, | |
| bos_token_id=bos_token_id, | |
| eos_token_id=eos_token_id, | |
| tie_word_embeddings=tie_word_embeddings, | |
| rope_theta=rope_theta, | |
| rope_scaling=rope_scaling, | |
| attention_bias=attention_bias, | |
| attention_dropout=attention_dropout, | |
| mlp_bias=mlp_bias, | |
| **kwargs, | |
| ) | |
| # Tool tokens | |
| self.tool_call_start_id = tool_call_start_id | |
| self.tool_call_end_id = tool_call_end_id | |
| self.tool_result_start_id = tool_result_start_id | |
| self.tool_result_end_id = tool_result_end_id | |
| # FIM tokens | |
| self.fim_prefix_id = fim_prefix_id | |
| self.fim_suffix_id = fim_suffix_id | |
| self.fim_middle_id = fim_middle_id | |