Views
No views yet
A compact assistant model specialized for industrial PLC programming.
Fine-tuned with Axolotl using QLoRA to follow instructions and generate logic across the five IEC 61131-3 languages: Structured Text (ST), Ladder Diagram ASCII (LD), Function Block Diagram ASCII (FBD), Instruction List (IL), and GRAFCET / SFC.
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4model_id = "ICSFR-HF-ORG-01/Valuoty-industry-plc-4B"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 device_map="auto",
10 torch_dtype=torch.bfloat16 if torch.cuda.is_available() else "auto",
11 trust_remote_code=True,
12)
13
14messages = [
15 {"role": "system", "content": "You are a senior PLC engineer. Follow IEC 61131-3 best practices."},
16 {"role": "user", "content": "Write a PID function block in Structured Text with anti-windup and usage notes."}
17]
18
19inputs = tokenizer.apply_chat_template(
20 messages, add_generation_prompt=True, return_tensors="pt"
21).to(model.device)
22
23with torch.no_grad():
24 outputs = model.generate(
25 inputs,
26 max_new_tokens=512,
27 do_sample=True,
28 temperature=0.2,
29 top_p=0.9,
30 repetition_penalty=1.05,
31 pad_token_id=tokenizer.eos_token_id,
32 eos_token_id=tokenizer.eos_token_id,
33 )
34
35print(tokenizer.decode(outputs[0], skip_special_tokens=True))
36System: You are a PLC expert. Use IEC 61131-3 Structured Text with clear comments.
User: Create FB ConveyorInterlock in ST.
Requirements:
- Inputs: StartCmd, StopCmd, EStop, GuardDoorClosed
- Output: ConveyorRun
- Latch start; drop on EStop or open guard door
- Add diagnostics strings and a test exampleSystem: Output Ladder Diagram in clean ASCII. Include rung titles and comments.
User: Build a motor start/stop circuit with seal-in, E-Stop, and overload trip.System: Output Function Block Diagram in ASCII with clear blocks and signal names.
User: Implement a ramp-up speed profile: TON pre-delay, then PID speed control with setpoint tracking.System: Use Instruction List. Comment each instruction briefly.
User: Create IL to compute a moving average over N samples with overflow protection.System: Output SFC (GRAFCET) text with steps S0..Sx, transitions T1..Tx, actions, and safety interlocks.
User: Batch filling: Idle → Fill → Hold → Drain; include E-Stop and LevelHi/Lo interlocks.
temperature=0.2–0.4, top_p=0.9.temperature=0.0; relax for brainstorming.1@software{Valuoty-industry-plc-4B,
2 title = {PLC Agentic Assistant (IEC 61131-3) — LoRA on Qwen/Qwen3-4B},
3 author = Laurent MAILLE SPIE ICS,
4 year = {2025},
5 publisher = {Hugging Face},
6 note = {Fine-tuned with Axolotl on PLC instruction-following tasks (ST, LD, FBD, IL, SFC).}
7}