Instructions to use AJKADZ/PHI_CODER with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use AJKADZ/PHI_CODER with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf AJKADZ/PHI_CODER:Q4_K_M # Run inference directly in the terminal: llama cli -hf AJKADZ/PHI_CODER:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf AJKADZ/PHI_CODER:Q4_K_M # Run inference directly in the terminal: llama cli -hf AJKADZ/PHI_CODER:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf AJKADZ/PHI_CODER:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf AJKADZ/PHI_CODER:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf AJKADZ/PHI_CODER:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf AJKADZ/PHI_CODER:Q4_K_M
Use Docker
docker model run hf.co/AJKADZ/PHI_CODER:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use AJKADZ/PHI_CODER with Ollama:
ollama run hf.co/AJKADZ/PHI_CODER:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use AJKADZ/PHI_CODER with Docker Model Runner:
docker model run hf.co/AJKADZ/PHI_CODER:Q4_K_M
- Lemonade
How to use AJKADZ/PHI_CODER with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AJKADZ/PHI_CODER:Q4_K_M
Run and chat with the model
lemonade run user.PHI_CODER-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Download phi-coder-hf/llama.cpp/tools/server/webui/src/components/useChatTextarea.ts from AJKADZ/PHI_CODER: direct link, hf CLI and curl.
- Browser
- Download file 4.31 kB
-
https://huggingface.co/AJKADZ/PHI_CODER/resolve/main/phi-coder-hf/llama.cpp/tools/server/webui/src/components/useChatTextarea.ts
- Command line
-
hf download hf://AJKADZ/PHI_CODER/phi-coder-hf/llama.cpp/tools/server/webui/src/components/useChatTextarea.ts
-
curl -L -o useChatTextarea.ts https://huggingface.co/AJKADZ/PHI_CODER/resolve/main/phi-coder-hf/llama.cpp/tools/server/webui/src/components/useChatTextarea.ts
4.31 kB
| import { useEffect, useRef, useState, useCallback } from 'react'; | |
| import { throttle } from '../utils/misc'; | |
| // Media Query for detecting "large" screens (matching Tailwind's lg: breakpoint) | |
| const LARGE_SCREEN_MQ = '(min-width: 1024px)'; | |
| // Calculates and sets the textarea height based on its scrollHeight | |
| const adjustTextareaHeight = throttle( | |
| (textarea: HTMLTextAreaElement | null) => { | |
| if (!textarea) return; | |
| // Only perform auto-sizing on large screens | |
| if (!window.matchMedia(LARGE_SCREEN_MQ).matches) { | |
| // On small screens, reset inline height and max-height styles. | |
| // This allows CSS (e.g., `rows` attribute or classes) to control the height, | |
| // and enables manual resizing if `resize-vertical` is set. | |
| textarea.style.height = ''; // Use 'auto' or '' to reset | |
| textarea.style.maxHeight = ''; | |
| return; // Do not adjust height programmatically on small screens | |
| } | |
| const computedStyle = window.getComputedStyle(textarea); | |
| // Get the max-height specified by CSS (e.g., from `lg:max-h-48`) | |
| const currentMaxHeight = computedStyle.maxHeight; | |
| // Temporarily remove max-height to allow scrollHeight to be calculated correctly | |
| textarea.style.maxHeight = 'none'; | |
| // Reset height to 'auto' to measure the actual scrollHeight needed | |
| textarea.style.height = 'auto'; | |
| // Set the height to the calculated scrollHeight | |
| textarea.style.height = `${textarea.scrollHeight}px`; | |
| // Re-apply the original max-height from CSS to enforce the limit | |
| textarea.style.maxHeight = currentMaxHeight; | |
| }, | |
| 100 | |
| ); // Throttle to prevent excessive calls | |
| // Interface describing the API returned by the hook | |
| export interface ChatTextareaApi { | |
| value: () => string; | |
| setValue: (value: string) => void; | |
| focus: () => void; | |
| ref: React.RefObject<HTMLTextAreaElement>; | |
| refOnSubmit: React.MutableRefObject<(() => void) | null>; // Submit handler | |
| onInput: (event: React.FormEvent<HTMLTextAreaElement>) => void; // Input handler | |
| } | |
| // This is a workaround to prevent the textarea from re-rendering when the inner content changes | |
| // See https://github.com/ggml-org/llama.cpp/pull/12299 | |
| // combined now with auto-sizing logic. | |
| export function useChatTextarea(initValue: string): ChatTextareaApi { | |
| const [savedInitValue, setSavedInitValue] = useState<string>(initValue); | |
| const textareaRef = useRef<HTMLTextAreaElement>(null); | |
| const onSubmitRef = useRef<(() => void) | null>(null); | |
| // Effect to set initial value and height on mount or when initValue changes | |
| useEffect(() => { | |
| const textarea = textareaRef.current; | |
| if (textarea) { | |
| if (typeof savedInitValue === 'string' && savedInitValue.length > 0) { | |
| textarea.value = savedInitValue; | |
| // Call adjustTextareaHeight - it will check screen size internally | |
| setTimeout(() => adjustTextareaHeight(textarea), 0); | |
| setSavedInitValue(''); // Reset after applying | |
| } else { | |
| // Adjust height even if there's no initial value (for initial render) | |
| setTimeout(() => adjustTextareaHeight(textarea), 0); | |
| } | |
| } | |
| }, [textareaRef, savedInitValue]); // Depend on ref and savedInitValue | |
| // On input change, we adjust the height of the textarea | |
| const handleInput = useCallback( | |
| (event: React.FormEvent<HTMLTextAreaElement>) => { | |
| // Call adjustTextareaHeight on every input - it will decide whether to act | |
| adjustTextareaHeight(event.currentTarget); | |
| }, | |
| [] | |
| ); | |
| return { | |
| // Method to get the current value directly from the textarea | |
| value: () => { | |
| return textareaRef.current?.value ?? ''; | |
| }, | |
| // Method to programmatically set the value and trigger height adjustment | |
| setValue: (value: string) => { | |
| const textarea = textareaRef.current; | |
| if (textarea) { | |
| textarea.value = value; | |
| // Call adjustTextareaHeight - it will check screen size internally | |
| setTimeout(() => adjustTextareaHeight(textarea), 0); | |
| } | |
| }, | |
| focus: () => { | |
| if (textareaRef.current) { | |
| textareaRef.current.focus(); | |
| } | |
| }, | |
| ref: textareaRef, | |
| refOnSubmit: onSubmitRef, | |
| onInput: handleInput, // for adjusting height on input | |
| }; | |
| } | |