Instructions to use VladHong/llama-cpp-K2-FAST2 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 VladHong/llama-cpp-K2-FAST2 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 VladHong/llama-cpp-K2-FAST2 # Run inference directly in the terminal: llama cli -hf VladHong/llama-cpp-K2-FAST2
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf VladHong/llama-cpp-K2-FAST2 # Run inference directly in the terminal: llama cli -hf VladHong/llama-cpp-K2-FAST2
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf VladHong/llama-cpp-K2-FAST2 # Run inference directly in the terminal: ./build/bin/llama cli -hf VladHong/llama-cpp-K2-FAST2
Use Docker
docker model run hf.co/VladHong/llama-cpp-K2-FAST2
- Llama new
- LM Studio
- Jan
- Ollama
How to use VladHong/llama-cpp-K2-FAST2 with Ollama:
ollama run hf.co/VladHong/llama-cpp-K2-FAST2
- Unsloth Desktop
- Docker Model Runner
How to use VladHong/llama-cpp-K2-FAST2 with Docker Model Runner:
docker model run hf.co/VladHong/llama-cpp-K2-FAST2
- Lemonade
How to use VladHong/llama-cpp-K2-FAST2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull VladHong/llama-cpp-K2-FAST2
Run and chat with the model
lemonade run user.llama-cpp-K2-FAST2-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
Download tools/ui/src/lib/hooks/use-auto-scroll.svelte.ts from VladHong/llama-cpp-K2-FAST2: direct link, hf CLI and curl.
- Browser
- Download file 5.52 kB
-
https://huggingface.co/VladHong/llama-cpp-K2-FAST2/resolve/main/tools/ui/src/lib/hooks/use-auto-scroll.svelte.ts
- Command line
-
hf download hf://VladHong/llama-cpp-K2-FAST2/tools/ui/src/lib/hooks/use-auto-scroll.svelte.ts
-
curl -L -o use-auto-scroll.svelte.ts https://huggingface.co/VladHong/llama-cpp-K2-FAST2/resolve/main/tools/ui/src/lib/hooks/use-auto-scroll.svelte.ts
5.52 kB
| import { AUTO_SCROLL_AT_BOTTOM_THRESHOLD, AUTO_SCROLL_INTERVAL } from '$lib/constants'; | |
| export interface AutoScrollOptions { | |
| disabled?: boolean; | |
| } | |
| /** | |
| * Creates an auto-scroll controller for a scrollable container. | |
| * | |
| * Features: | |
| * - Auto-scrolls to bottom during streaming/loading | |
| * - Stops auto-scroll when user manually scrolls up | |
| * - Resumes auto-scroll when user scrolls back to bottom | |
| */ | |
| export class AutoScrollController { | |
| private _autoScrollEnabled = $state(true); | |
| private _container: HTMLElement | undefined; | |
| private _disabled: boolean; | |
| private _lastScrollTop = $state(0); | |
| private _mutationObserver: MutationObserver | null = null; | |
| private _observerEnabled = false; | |
| private _rafPending = false; | |
| private _scrollInterval: ReturnType<typeof setInterval> | undefined; | |
| private _userScrolledUp = $state(false); | |
| get autoScrollEnabled(): boolean { | |
| return this._autoScrollEnabled; | |
| } | |
| get userScrolledUp(): boolean { | |
| return this._userScrolledUp; | |
| } | |
| constructor(options: AutoScrollOptions = {}) { | |
| this._disabled = options.disabled ?? false; | |
| } | |
| /** | |
| * Cleans up resources. Call this in onDestroy or when the component unmounts. | |
| */ | |
| destroy(): void { | |
| this.stopInterval(); | |
| this._doStopObserving(); | |
| } | |
| /** | |
| * Enables auto-scroll (e.g., when user sends a message). | |
| */ | |
| enable(): void { | |
| if (this._disabled) return; | |
| this._userScrolledUp = false; | |
| this._autoScrollEnabled = true; | |
| } | |
| /** | |
| * Handles scroll events to detect user scroll direction and toggle auto-scroll. | |
| */ | |
| handleScroll(): void { | |
| if (this._disabled || !this._container) return; | |
| const { clientHeight, scrollHeight, scrollTop } = this._container; | |
| const distanceFromBottom = scrollHeight - clientHeight - scrollTop; | |
| const isScrollingUp = scrollTop < this._lastScrollTop; | |
| const isAtBottom = distanceFromBottom < AUTO_SCROLL_AT_BOTTOM_THRESHOLD; | |
| if (isScrollingUp && !isAtBottom) { | |
| this._userScrolledUp = true; | |
| this._autoScrollEnabled = false; | |
| } else if (isAtBottom && this._userScrolledUp) { | |
| this._userScrolledUp = false; | |
| this._autoScrollEnabled = true; | |
| } | |
| this._lastScrollTop = scrollTop; | |
| } | |
| /** | |
| * Resets scroll state when switching conversations. | |
| */ | |
| resetScrollState(): void { | |
| this._userScrolledUp = false; | |
| this._autoScrollEnabled = !this._disabled; | |
| if (this._container) { | |
| this._lastScrollTop = this._container.scrollTop; | |
| } | |
| } | |
| /** | |
| * Scrolls the container to the bottom instantly. | |
| */ | |
| scrollToBottom(): void { | |
| if (this._disabled || !this._container) return; | |
| this._container.scrollTop = this._container.scrollHeight; | |
| } | |
| /** | |
| * Binds the controller to a scrollable container element. | |
| */ | |
| setContainer(container: HTMLElement | undefined): void { | |
| this._doStopObserving(); | |
| this._container = container; | |
| if (this._observerEnabled && container && !this._disabled) { | |
| this._doStartObserving(); | |
| } | |
| } | |
| /** | |
| * Updates the disabled state. | |
| */ | |
| setDisabled(disabled: boolean): void { | |
| if (this._disabled === disabled) return; | |
| this._disabled = disabled; | |
| if (disabled) { | |
| this._autoScrollEnabled = false; | |
| this.stopInterval(); | |
| this._doStopObserving(); | |
| } else if (this._observerEnabled && this._container && !this._mutationObserver) { | |
| this._doStartObserving(); | |
| } | |
| } | |
| /** | |
| * Starts the auto-scroll interval for continuous scrolling during streaming. | |
| */ | |
| startInterval(): void { | |
| if (this._disabled || this._scrollInterval) return; | |
| this._scrollInterval = setInterval(() => { | |
| this.scrollToBottom(); | |
| }, AUTO_SCROLL_INTERVAL); | |
| } | |
| /** | |
| * Starts a MutationObserver on the container that auto-scrolls to bottom | |
| * on content changes. More responsive than interval-based polling. | |
| */ | |
| startObserving(): void { | |
| this._observerEnabled = true; | |
| if (this._container && !this._disabled && !this._mutationObserver) { | |
| this._doStartObserving(); | |
| } | |
| } | |
| /** | |
| * Stops the auto-scroll interval. | |
| */ | |
| stopInterval(): void { | |
| if (this._scrollInterval) { | |
| clearInterval(this._scrollInterval); | |
| this._scrollInterval = undefined; | |
| } | |
| } | |
| /** | |
| * Stops the MutationObserver. | |
| */ | |
| stopObserving(): void { | |
| this._observerEnabled = false; | |
| this._doStopObserving(); | |
| } | |
| /** | |
| * Updates the auto-scroll interval based on streaming state. | |
| * Call this in a $effect to automatically manage the interval. | |
| */ | |
| updateInterval(isStreaming: boolean): void { | |
| if (this._disabled) { | |
| this.stopInterval(); | |
| return; | |
| } | |
| if (isStreaming && this._autoScrollEnabled) { | |
| if (!this._scrollInterval) { | |
| this.startInterval(); | |
| } | |
| } else { | |
| this.stopInterval(); | |
| } | |
| } | |
| private _doStartObserving(): void { | |
| if (!this._container || this._mutationObserver) return; | |
| this._mutationObserver = new MutationObserver(() => { | |
| if (!this._autoScrollEnabled || this._rafPending) return; | |
| this._rafPending = true; | |
| requestAnimationFrame(() => { | |
| this._rafPending = false; | |
| if (this._autoScrollEnabled && this._container) { | |
| this._container.scrollTop = this._container.scrollHeight; | |
| } | |
| }); | |
| }); | |
| this._mutationObserver.observe(this._container, { | |
| characterData: true, | |
| childList: true, | |
| subtree: true | |
| }); | |
| } | |
| private _doStopObserving(): void { | |
| if (this._mutationObserver) { | |
| this._mutationObserver.disconnect(); | |
| this._mutationObserver = null; | |
| } | |
| this._rafPending = false; | |
| } | |
| } | |
| /** | |
| * Creates a new AutoScrollController instance. | |
| */ | |
| export function createAutoScrollController(options: AutoScrollOptions = {}): AutoScrollController { | |
| return new AutoScrollController(options); | |
| } | |