Text Generation
Transformers
Safetensors
phi3
Generated from Trainer
trl
sft
conversational
custom_code
text-generation-inference
Instructions to use turtle170/TinyCode-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use turtle170/TinyCode-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="turtle170/TinyCode-4B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("turtle170/TinyCode-4B", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("turtle170/TinyCode-4B", trust_remote_code=True, 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use turtle170/TinyCode-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "turtle170/TinyCode-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": "turtle170/TinyCode-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/turtle170/TinyCode-4B
- SGLang
How to use turtle170/TinyCode-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 "turtle170/TinyCode-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": "turtle170/TinyCode-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 "turtle170/TinyCode-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": "turtle170/TinyCode-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use turtle170/TinyCode-4B with Docker Model Runner:
docker model run hf.co/turtle170/TinyCode-4B
Model save
Browse filesFiles changed (3)
- README.md+3-3
- model.safetensors+1-1
- training_args.bin+1-1
1234567891011121314151617---base_model: microsoft/Phi-4-mini-instructlibrary_name: transformersmodel_name: TinyCode-4Btags:- generated_from_trainer- sft- trllicence: license---# Model Card for TinyCode-4BThis model is a fine-tuned version of [microsoft/Phi-4-mini-instruct](https://huggingface.co/microsoft/Phi-4-mini-instruct).It has been trained using [TRL](https://github.com/huggingface/trl).## Quick start1234567891011121314151617---base_model: turtle170/TinyCode-4Blibrary_name: transformersmodel_name: TinyCode-4Btags:- generated_from_trainer- trl- sftlicence: license---# Model Card for TinyCode-4BThis model is a fine-tuned version of [turtle170/TinyCode-4B](https://huggingface.co/turtle170/TinyCode-4B).It has been trained using [TRL](https://github.com/huggingface/trl).## Quick start
123version https://git-lfs.github.com/spec/v1oid sha256:9d5258eca571e7658bf0aed1eb80d7d0679de716ca6f62d8122062d2a1c770d9size 7672066248123version https://git-lfs.github.com/spec/v1oid sha256:6b87ba4ec150bbb16ab3a02037c8b0db4d4dfebe7ec22cf9fd2e8002fe3ded21size 7672066248
123version https://git-lfs.github.com/spec/v1oid sha256:5912a5662f5d9374faa2e378850dfd97cf8a1ffc29a3fa9f6498a8324d264749size 5777123version https://git-lfs.github.com/spec/v1oid sha256:38ace7b11146267788d69a00b60ec7ec477ae47352aa32b5aefdacdbb11c9191size 5777
README.md+3-3
model.safetensors+1-1
training_args.bin+1-1