Text Generation
Transformers
Safetensors
GGUF
Chinese
English
mixtral
gomoku
ollama
Mixture of Experts
conversational
text-generation-inference
Instructions to use l898974766/gomoku with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use l898974766/gomoku with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="l898974766/gomoku") 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("l898974766/gomoku") model = AutoModelForCausalLM.from_pretrained("l898974766/gomoku", 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
- llama.cpp
How to use l898974766/gomoku 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 l898974766/gomoku:F32 # Run inference directly in the terminal: llama cli -hf l898974766/gomoku:F32
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf l898974766/gomoku:F32 # Run inference directly in the terminal: llama cli -hf l898974766/gomoku:F32
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 l898974766/gomoku:F32 # Run inference directly in the terminal: ./build/bin/llama cli -hf l898974766/gomoku:F32
Use Docker
docker model run hf.co/l898974766/gomoku:F32
- Llama new
- LM Studio
- Jan
- vLLM
How to use l898974766/gomoku with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "l898974766/gomoku" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "l898974766/gomoku", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/l898974766/gomoku:F32
- SGLang
How to use l898974766/gomoku 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 "l898974766/gomoku" \ --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": "l898974766/gomoku", "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 "l898974766/gomoku" \ --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": "l898974766/gomoku", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use l898974766/gomoku with Ollama:
ollama run hf.co/l898974766/gomoku:F32
- Unsloth Desktop
- Docker Model Runner
How to use l898974766/gomoku with Docker Model Runner:
docker model run hf.co/l898974766/gomoku:F32
- Lemonade
How to use l898974766/gomoku with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull l898974766/gomoku:F32
Run and chat with the model
lemonade run user.gomoku-F32
List all available models
lemonade list
- Atomic Chat
File size: 2,208 Bytes
ab8fca0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | """Lossless raw directional board context; no tactical scoring or move selection."""
import re
CONTEXT_LENGTH = 2048
SYSTEM = ('Play 15x15 Gomoku. X is you, O is the opponent, . is empty, # is outside. '
'Each empty coordinate has four 9-cell raw lines: horizontal, vertical, '
'diagonal down and diagonal up. Occupied cells are <coordinate:X/O>. '
'Read the board and reply with one empty coordinate only.')
DIRECTIONS = [(1, 0), (0, 1), (1, 1), (1, -1)]
def validate_board(board):
if not isinstance(board, list) or len(board) != 225 or any(type(v) is not int or v not in (0, 1, 2) for v in board):
raise ValueError('board must contain 225 integers in {0, 1, 2}')
def coordinate(move):
if type(move) is not int or not 0 <= move < 225:
raise ValueError('invalid move index')
return f'{chr(65+move % 15)}{move//15+1}'
def lines_at(board, move):
x, y = move % 15, move//15
return [''.join('.XO'[board[(y+k*dy)*15+x+k*dx]] if 0 <= x+k*dx < 15 and 0 <= y+k*dy < 15 else '#'
for k in range(-4, 5)) for dx, dy in DIRECTIONS]
def records(board):
validate_board(board)
return [f'<{coordinate(m)}:{".XO"[v]}>' if v else coordinate(m)+''.join('<line:'+line+'>' for line in lines_at(board, m))
for m, v in enumerate(board)]
def board_text(board):
cells = records(board)
return '\n'.join(''.join(cells[y*15:(y+1)*15]) for y in range(15))+'\nYour move:'
def messages(board):
return [{'role': 'system', 'content': SYSTEM}, {'role': 'user', 'content': board_text(board)}]
def parse_move(text, board):
validate_board(board)
match = re.fullmatch(r'([A-O])(1[0-5]|[1-9])', text.strip(), flags=re.IGNORECASE)
if not match:
raise ValueError('model did not generate exactly one coordinate')
move = (int(match[2])-1)*15+ord(match[1].upper())-65
if board[move]:
raise ValueError('model selected an occupied cell')
return move
def relative(board, player):
validate_board(board)
if type(player) is not int or player not in (1, 2):
raise ValueError('player must be 1 or 2')
return [0 if v == 0 else 1 if v == player else 2 for v in board]
|