# GPT4All-Model (Hanuman) This folder contains the files needed to load and run the custom Hanuman model. Included files: - `pytorch_model.bin` — model weights - `config.json` — model configuration - `tokenizer.json`, `tokenizer_config.json`, `special_tokens_map.json` — tokenizer files - `modeling.py` — custom `Hanuman` model implementation - `hanuman_loader.py` — convenience loader (optional) Quick usage (local files in this folder): ```python # inference_local.py from transformers import AutoTokenizer from modeling import Hanuman import torch # load tokenizer from local folder tokenizer = AutoTokenizer.from_pretrained('.') # load model using the provided helper model = Hanuman.from_pretrained('.', map_location='cpu') prompt = "สวัสดีครับ ช่วยอธิบายสั้น ๆ เกี่ยวกับประเทศไทย" inputs = tokenizer(prompt, return_tensors='pt') outputs = model.generate(inputs['input_ids'], max_new_tokens=50, temperature=1.2, top_k=50, top_p=0.95) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` Or load from the Hugging Face Hub (if this folder was uploaded to the hub as the repo root): ```python # inference_from_hub.py from transformers import AutoTokenizer from hanuman_loader import HanumanModel repo_id = "ZombitX64/GPT4All-Model" # tokenizer will download from HF tokenizer = AutoTokenizer.from_pretrained(repo_id) # HanumanModel downloads weights and modeling.py dynamically model_wrapper = HanumanModel.from_pretrained(repo_id, map_location='cpu') model = model_wrapper.model prompt = "สวัสดีครับ ช่วยสรุปประเทศไทยสั้น ๆ" inputs = tokenizer(prompt, return_tensors='pt') outputs = model.generate(inputs['input_ids'], max_new_tokens=50) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` Notes: - This repo uses a custom model class (`Hanuman`) — users must keep `modeling.py` or use the provided `hanuman_loader.py` that dynamically imports it. - For CPU inference, install a CPU build of PyTorch. For GPU, install the appropriate CUDA-enabled PyTorch.