Instructions to use kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned") model = AutoModelForCausalLM.from_pretrained("kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned") 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
- vLLM
How to use kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned
- SGLang
How to use kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned 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 "kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned" \ --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": "kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned", "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 "kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned" \ --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": "kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned with Docker Model Runner:
docker model run hf.co/kainoj/LiquidAI-LFM2-1.2B-Extract-ja-pii-finetuned
LiquidAI/LFM2-1.2B-Extract finetuned on Japanese content to output JSON with PII. The model should output only single json with four fields:
{
"full_name": "name of the person",
"company_name": "name of the company",
"address": "address of the plance",
"phone_number": "phone number"
}
Coded during Liquid AI hackathon in Tokyo.
Evaluations
Evaluation on test split of stockmark/ner-wikipedia-dataset:
- Test accuracy on raw model using wiki dataset:
0.9100-->1.0after fine-tunning.
That dataset is somehow simple. We generated 64 samples of long contracts containing PII in Japanese. We used it only to evaluate the final perfomrance of the models
- Test accuracy on raw model using OUR dataset:
0.5781-->0.9688after fine-tunning.
Evaluation methodology
We use an exact match on generated JSON. The output of SLM must be a valid JSON with exactly four required fields, no less, no more.
Model Details
- Developed by: @kainoj, @valeriosalvucci and @gangadhara691
- Language(s) (NLP): Japanese
- License:
lfm1.0 - Finetuned from model: LiquidAI/LFM2-1.2B-Extract
- Finetued on dataset: stockmark/ner-wikipedia-dataset
- Downloads last month
- 7