Text Generation
Transformers
Safetensors
llama
trl
sft
python
code
conversational
text-generation-inference
Instructions to use Fadilahnuryasin/Assistant-Coding-Python with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Fadilahnuryasin/Assistant-Coding-Python with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Fadilahnuryasin/Assistant-Coding-Python") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Fadilahnuryasin/Assistant-Coding-Python") model = AutoModelForCausalLM.from_pretrained("Fadilahnuryasin/Assistant-Coding-Python", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Fadilahnuryasin/Assistant-Coding-Python with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Fadilahnuryasin/Assistant-Coding-Python" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Fadilahnuryasin/Assistant-Coding-Python", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Fadilahnuryasin/Assistant-Coding-Python
- SGLang
How to use Fadilahnuryasin/Assistant-Coding-Python 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 "Fadilahnuryasin/Assistant-Coding-Python" \ --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": "Fadilahnuryasin/Assistant-Coding-Python", "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 "Fadilahnuryasin/Assistant-Coding-Python" \ --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": "Fadilahnuryasin/Assistant-Coding-Python", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Fadilahnuryasin/Assistant-Coding-Python with Docker Model Runner:
docker model run hf.co/Fadilahnuryasin/Assistant-Coding-Python
|
Download README.md from Fadilahnuryasin/Assistant-Coding-Python: direct link, hf CLI and curl.
- Browser
- Download file 1.98 kB
-
https://huggingface.co/Fadilahnuryasin/Assistant-Coding-Python/resolve/main/README.md
- Command line
-
hf download hf://Fadilahnuryasin/Assistant-Coding-Python/README.md
-
curl -L -o README.md https://huggingface.co/Fadilahnuryasin/Assistant-Coding-Python/resolve/main/README.md
1.98 kB
| library_name: transformers | |
| tags: | |
| - trl | |
| - sft | |
| - python | |
| - code | |
| - conversational | |
| license: mit | |
| # Model Card for Assistant-Coding-Python | |
| ## Model Details | |
| ### Model Description | |
| Assistant-Coding-Python is a fine-tuned causal language model based on **SmolLM2-360M**. It is specifically trained to assist and answer various Python programming questions, ranging from implementing basic mathematical functions to data structure manipulation. | |
| - **Developed by:** Fadilahnuryasin | |
| - **Model type:** Causal Language Model (Fine-tuned with Supervised Fine-Tuning) | |
| - **Language(s) (NLP):** English, Python | |
| - **License:** MIT | |
| - **Finetuned from model:** HuggingFaceTB/SmolLM2-360M | |
| ## Uses | |
| ### Direct Use | |
| This model is designed to act as a coding assistant, helping users write Python code, solve basic logic problems, and understand Python syntax. | |
| ### Out-of-Scope Use | |
| This model is not designed for deployment in critical systems requiring high safety verification or complex, enterprise-scale code generation without human supervision. | |
| ## Bias, Risks, and Limitations | |
| As a small-scale model (360M parameters), it may occasionally produce inaccurate outputs on complex mathematical logic or incorrectly predict final execution results. Users are advised to review and test all generated code before use. | |
| ## How to Get Started with the Model | |
| Use the code below to get started with the model using the Transformers library: | |
| ```python | |
| from transformers import pipeline | |
| pipe = pipeline("text-generation", model="Fadilahnuryasin/Assistant-Coding-Python") | |
| messages = [ | |
| {"role": "system", "content": "You are an expert and helpful Python programming assistant."}, | |
| {"role": "user", "content": "Create a Python function to calculate the area of a rectangle."} | |
| ] | |
| prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) | |
| outputs = pipe(prompt, max_new_tokens=200, do_sample=True, temperature=0.2) | |
| print(outputs[0]["generated_text"]) |