CoolFace
Modelpublic

ce-lery/mistral-300m-base

sourceHugging Faceupdated 1y agoView on Hugging Face
1likes17downloads
Model Card

<!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. -->

mistral-300m-base

Overview

Welcome to my model card!

This Model feature is ...

  • Suppression of unknown word generation by using byte fallback in SentencePiece tokenizer and conversion to huggingface Tokenizers format
  • Pretrained by wikipedia dataset and cc100 dataset
  • Use of Mistral 300M

Yukkuri shite ittene!

How to use the model

python
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
import torch

MODEL_NAME = "ce-lery/mistral-300m-base"
torch.set_float32_matmul_precision('high')

DEVICE = "cuda"
if torch.cuda.is_available():
    print("cuda")
    DEVICE = "cuda"
else:
    print("cpu")
    DEVICE = "cpu"

tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME,use_fast=False)
model = AutoModelForCausalLM.from_pretrained(
    MODEL_NAME,
    trust_remote_code=True,
).to(DEVICE)

# streamer = TextStreamer(tokenizer)

prompt = "自然言語処理とは、"

inputs = tokenizer(prompt, add_special_tokens=False,return_tensors="pt").to(model.device)
with torch.no_grad():

    outputs = model.generate(
        inputs["input_ids"],
        max_new_tokens=1024,
        do_sample=True,
        early_stopping=False,
        top_p=0.95,
        top_k=50,
        temperature=0.1,
        # streamer=streamer,
        no_repeat_ngram_size=2,
        num_beams=3
    )

print(outputs.tolist()[0])
outputs_txt = tokenizer.decode(outputs[0])
print(outputs_txt)

Receipe

If you want to restruct this model, you can refer this Github repository.

If you find my mistake,error,...etc, please create issue. If you create pulreqest, I'm very happy!

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 0.0003
  • trainbatchsize: 12
  • evalbatchsize: 12
  • seed: 42
  • gradientaccumulationsteps: 20
  • totaltrainbatch_size: 240
  • optimizer: Use OptimizerNames.ADAMWBNB with betas=(0.9,0.95) and epsilon=1e-08 and optimizerargs=No additional optimizer arguments
  • lrschedulertype: cosinewithmin_lr
  • lrschedulerwarmup_steps: 1000
  • num_epochs: 1.0

Training results

Training LossEpochStepValidation Loss
3.79690.2212100003.4418
3.6590.4424200003.2704
3.57210.6635300003.1969
3.56780.8847400003.1757

Framework versions

  • Transformers 4.55.2
  • Pytorch 2.8.0+cu128
  • Datasets 4.0.0
  • Tokenizers 0.21.4