# haznitrama/babybabellm-gpt_bert-ace-causal GPT-BERT style BabyBabyLLM monolingual model for language **ace**. This repository mirrors the layout of the multi-all reference models: it may contain both *main* and *EMA* variants. **Default variant exposed to generic loaders:** `ema` ## Variants Available ema, main ## Files - model.safetensors (alias of default variant) - model_ema.safetensors - pytorch_model.bin (legacy PyTorch format) ## Configuration ```json { "attention_probs_dropout_prob": 0.1, "hidden_dropout_prob": 0.1, "hidden_size": 384, "intermediate_size": 1280, "max_position_embeddings": 512, "position_bucket_size": 32, "num_attention_heads": 6, "num_hidden_layers": 12, "vocab_size": 8192, "layer_norm_eps": 1e-05, "auto_map": { "AutoConfig": "configuration_gpt_bert.GPTBertConfig", "AutoModel": "modeling_gpt_bert.GPTBertForMaskedLM", "AutoModelForCausalLM": "modeling_gpt_bert.GPTBertForMaskedLM", "AutoModelForMaskedLM": "modeling_gpt_bert.GPTBertForMaskedLM" }, "return_dict": true, "output_hidden_states": false, "torchscript": false, "dtype": "float32", "pruned_heads": {}, "tie_word_embeddings": true, "chunk_size_feed_forward": 0, "is_encoder_decoder": false, "is_decoder": false, "cross_attention_hidden_size": null, "add_cross_attention": false, "tie_encoder_decoder": false, "architectures": [ "GPTBertForMaskedLM" ], "finetuning_task": null, "id2label": { "0": "LABEL_0", "1": "LABEL_1" }, "label2id": { "LABEL_0": 0, "LABEL_1": 1 }, "task_specific_params": null, "problem_type": null, "tokenizer_class": null, "prefix": null, "bos_token_id": null, "pad_token_id": null, "eos_token_id": null, "sep_token_id": null, "decoder_start_token_id": null, "max_length": 20, "min_length": 0, "do_sample": false, "early_stopping": false, "num_beams": 1, "num_beam_groups": 1, "diversity_penalty": 0.0, "temperature": 1.0, "top_k": 50, "top_p": 1.0, "typical_p": 1.0, "repetition_penalty": 1.0, "length_penalty": 1.0, "no_repeat_ngram_size": 0, "encoder_no_repeat_ngram_size": 0, "bad_words_ids": null, "num_return_sequences": 1, "output_scores": false, "return_dict_in_generate": false, "forced_bos_token_id": null, "forced_eos_token_id": null, "remove_invalid_values": false, "exponential_decay_length_penalty": null, "suppress_tokens": null, "begin_suppress_tokens": null, "_name_or_path": "", "transformers_version": "4.56.1", "tf_legacy_loss": false, "use_bfloat16": false, "model_type": "gpt_bert", "output_attentions": false } ``` Tokenizer file: `tokenizer_ace_vs8192.json` ## Quick Usage ```python from transformers import AutoTokenizer, AutoModelForMaskedLM model_id = 'haznitrama/babybabellm-gpt_bert-ace-causal' tok = AutoTokenizer.from_pretrained(model_id) model = AutoModelForMaskedLM.from_pretrained(model_id, trust_remote_code=True) out = model(**tok('Hello world', return_tensors='pt')) ``` Select a specific variant explicitly (when both present): ```python # Load EMA weights explicitly if both are present from safetensors.torch import load_file import torch from transformers import AutoConfig, AutoModelForMaskedLM model_id = 'haznitrama/babybabellm-gpt_bert-ace-causal' config = AutoConfig.from_pretrained(model_id, trust_remote_code=True) model = AutoModelForMaskedLM.from_config(config, trust_remote_code=True) state_dict = torch.load('pytorch_model.bin') # or load_file('model_ema.safetensors') model.load_state_dict(state_dict, strict=False) ``` ### Causal LM Wrapper This repo includes a lightweight GPTBertForCausalLM wrapper. Generation example: ```python from transformers import AutoTokenizer, AutoModelForCausalLM mid='haznitrama/babybabellm-gpt_bert-ace-causal' tok=AutoTokenizer.from_pretrained(mid) model=AutoModelForCausalLM.from_pretrained(mid, trust_remote_code=True) print(tok.decode(model.generate(**tok('Hello', return_tensors='pt'), max_new_tokens=20)[0], skip_special_tokens=True)) ``` ## Notes - Converted on 2025-09-16T06:15:08.548402Z - Safe serialization (safetensors) used; `pytorch_model.bin` added for legacy tools. - Requires `trust_remote_code=True` due to custom architecture. - EMA (Exponential Moving Average) weights can yield slightly better evaluation metrics; choose according to your needs.