How to use from
Ollama
ollama run hf.co/aokitools/japanese-laws-egov-instruct-202508031857
Quick Links

Experimental model in research stage

Quickstart

If you're using Ollama, run the following command first, then restart the Ollama app and select the newly added model.

ollama pull hf.co/aokitools/japanese-laws-egov-instruct-202508031857

If you want to remove it, run the following command:

ollama list
ollama rm hf.co/aokitools/japanese-laws-egov-instruct-202508031857:latest
ollama list

To use it from Python, use the following code.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig

model_name = "aokitools/japanese-laws-egov-instruct-202508031857"

quant_config = BitsAndBytesConfig(
    load_in_8bit=True,
    llm_int8_threshold=6.0,
)

# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.float16,
    device_map="auto",
    quantization_config=quant_config,
)

# prepare the model input
prompt = "Give me a short introduction to large language model."
messages = [
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=True # Switches between thinking and non-thinking modes. Default is True.
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

# conduct text completion
generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=256
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() 

# parsing thinking content
try:
    # rindex finding 151668 (</think>)
    index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
    index = 0

thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")

print("thinking content:", thinking_content)
print("content:", content)

This model is a continual pretraining of Qwen/Qwen3-1.7B.

Training details

  • Base model: Qwen3-1.7B
  • Tokenizer: QwenTokenizer

License

  • Apache 2.0 + Alibaba Qianwen License
Downloads last month
12
Safetensors
Model size
2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support