--- tags: - chain-of-thought - cot-reasoning - step-by-step-reasoning - systematic-analysis - problem-decomposition - structured-output - structured-thinking - reasoning-model - gmsh-scripting - mesh-generation - computational-geometry - finite-element-analysis - engineering-simulation - cad-mesh-automation - geometric-modeling - numerical-methods - engineering-research - computational-engineering - mesh-optimization - geometry-processing - simulation-preprocessing - technical-code-generation - domain-specific-reasoning - engineering-assistant - 8b-parameters - dense-decoder-model - open-source-model - GMeshNet-OSS-8B - GMeshNet-OSS - GMeshNet license: apache-2.0 language: - en --- # GMeshNet-OSS-8B GMeshNet-OSS-8B is an open-source, dense, decoder-only 8B parameter large language model optimized for **chain-of-thought reasoning**, designed to produce structured analyses and generate robust **Gmsh meshing scripts**. --- ## Quickstart ### Install Dependencies ``` pip install -U torch transformers accelerate ``` ### Run Inference ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer # Input your prompt here USER_INPUT = """ Generate a GMSH script to create a 2D rectangular mesh with a circular hole at the center, applying finer mesh refinement near the hole and coarser mesh at the boundaries. """ def load_model(model_path): model = AutoModelForCausalLM.from_pretrained( model_path, torch_dtype=torch.float16, device_map="auto", trust_remote_code=True ) tokenizer = AutoTokenizer.from_pretrained( model_path, trust_remote_code=True ) with open(f"{model_path}/chat_template.jinja", "r") as f: tokenizer.chat_template = f.read() return model, tokenizer def generate_response(model, tokenizer, user_input): formatted_input = f"{user_input.strip()}" messages = [{"role": "user", "content": formatted_input}] prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) inputs = tokenizer(prompt, return_tensors="pt").to(model.device) outputs = model.generate( **inputs, max_new_tokens=2000, temperature=0.7, do_sample=True, pad_token_id=tokenizer.eos_token_id ) response = tokenizer.decode(outputs[0], skip_special_tokens=False) return response.split("<|im_start|>assistant\n")[-1].replace("<|im_end|>", "").strip() def run_inference(): model_path = "./" # Path to your model weights model, tokenizer = load_model(model_path) result = generate_response(model, tokenizer, USER_INPUT) print(result) if __name__ == "__main__": run_inference() ``` --- ## Example Output ~~~ I need to analyze this meshing task step by step to create an effective GMSH script. 1. Geometry Requirements: - Main domain: Rectangular plate (let's assume 10x10 units) - Internal feature: Circular hole at center (radius 1 unit) - Mesh requirements: Finer elements near hole, coarser elements at boundaries 2. Meshing Approach: - Unstructured triangular mesh for flexibility around complex features - Size field to control element gradation from fine near hole to coarse at boundaries - Boundary layer not strictly necessary but could be added if flow simulation is intended 3. Construction Steps: - Define rectangle points (4 corners) - Define circle points (center + 4 quadrant points) - Create line loops for both shapes - Create surface with hole using Plane Surface command - Set up size field for gradation control - Generate mesh 1. High-level overview: - Create 10x10 rectangular domain centered at origin - Add circular hole of radius 1 at center - Use distance-based size field to refine mesh near hole - Generate unstructured triangular mesh with smooth gradation 2. Step-by-step instructions: a) Create rectangle points (4 corners) b) Create circle points (center + 4 quadrants) c) Connect points with lines/arcs d) Form line loops e) Create surface with hole f) Set up size field g) Generate mesh 3. Complete GMSH script: ``` // Rectangle with circular hole - graded mesh example // Geometry parameters rect_size = 5; // Half-width/height of rectangle hole_radius = 1; // Radius of central hole // Points for rectangle Point(1) = {-rect_size, -rect_size, 0}; Point(2) = {rect_size, -rect_size, 0}; Point(3) = {rect_size, rect_size, 0}; Point(4) = {-rect_size, rect_size, 0}; // Points for circle (center + 4 quadrants) Point(5) = {0, 0, 0}; // Center Point(6) = {hole_radius, 0, 0}; Point(7) = {0, hole_radius, 0}; Point(8) = {-hole_radius, 0, 0}; Point(9) = {0, -hole_radius, 0}; // Lines for rectangle Line(1) = {1, 2}; Line(2) = {2, 3}; Line(3) = {3, 4}; Line(4) = {4, 1}; // Circle arcs Circle(5) = {6, 5, 7}; Circle(6) = {7, 5, 8}; Circle(7) = {8, 5, 9}; Circle(8) = {9, 5, 6}; // Line loops Line Loop(1) = {1, 2, 3, 4}; // Outer rectangle Line Loop(2) = {5, 6, 7, 8}; // Inner circle // Surface with hole Plane Surface(1) = {1, 2}; // Mesh size control - fine near hole, coarse at boundaries Field[1] = Distance; Field[1].NodesList = {5}; // Measure distance from center point Field[1].NNodesByEdge = 100; Field[2] = Threshold; Field[2].InField = 1; Field[2].SizeMin = 0.05; // Fine mesh near hole Field[2].SizeMax = 0.5; // Coarse mesh far away Field[2].DistMin = hole_radius; Field[2].DistMax = 2*hole_radius; Background Field = 2; // Physical groups for boundaries Physical Curve("OuterBoundary", 1) = {1, 2, 3, 4}; Physical Curve("InnerBoundary", 2) = {5, 6, 7, 8}; Physical Surface("Domain", 1) = {1}; // Mesh settings Mesh.Algorithm = 6; // Frontal-Delaunay Mesh.Smoothing = 5; Mesh.CharacteristicLengthExtendFromBoundary = 1; // Generate 2D mesh Mesh 2; ``` 4. Implementation Notes: - To run: Open in GMSH → Mesh → 2D - Adjust parameters as needed: * rect_size: Change rectangle dimensions * hole_radius: Modify hole size * SizeMin/SizeMax: Control mesh density * DistMin/DistMax: Control refinement region extent - For structured mesh option, add Transfinite lines/surface commands - Visualize geometry first (Geometry tab) before meshing - Common errors to avoid: * Missing line loops * Incorrect point references in curves * Overlapping or intersecting geometries ~~~ --- ## Citation ```bibtex @software{Callimesh_GMeshNet-OSS-8B_v1.0, author = {{Callimesh}}, title = {GMeshNet-OSS-8B}, version = {1.0.0}, url = {https://huggingface.co/Callimesh/GMeshNet-OSS-8B}, doi = {10.57967/hf/6325} } ```