YAML Metadata Warning: The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other

NanoLM-70M-Instruct-v1

English | 简体中文

Introduction

In order to explore the potential of small models, I have attempted to build a series of them, which are available in the NanoLM Collections.

This is NanoLM-70M-Instruct-v1. The model currently supports English only.

Model Details

Nano LMs Non-emb Params Arch Layers Dim Heads Seq Len
25M 15M MistralForCausalLM 12 312 12 2K
70M 42M LlamaForCausalLM 12 576 9 2K
0.3B 180M Qwen2ForCausalLM 12 896 14 4K
1B 840M Qwen2ForCausalLM 18 1536 12 4K

The tokenizer and model architecture of NanoLM-70M-Instruct-v1 are the same as SmolLM-135M, but the number of layers has been reduced from 30 to 12.

Essentially, it is a pure LLaMA architecture, specifically LlamaForCausalLM.

As a result, NanoLM-70M-Instruct-v1 has only 70 million parameters.

Despite this, NanoLM-70M-Instruct-v1 still demonstrates instruction-following capabilities.

How to use

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_path = 'Mxode/NanoLM-70M-Instruct-v1'

model = AutoModelForCausalLM.from_pretrained(model_path).to('cuda:0', torch.bfloat16)
tokenizer = AutoTokenizer.from_pretrained(model_path)


text = "Why is it important for entrepreneurs to prioritize financial management?"
prompt = tokenizer.apply_chat_template(
    [
        {'role': 'system', 'content': 'You are a helpful assistant.'},
        {'role': 'user', 'content': text}
    ],
    add_generation_prompt=True,
    tokenize=True,
    return_tensors='pt'
).to('cuda:0')


outputs = model.generate(
    prompt,
    max_new_tokens=1024,
    do_sample=True,
    temperature=0.7,
    repetition_penalty=1.1,
    eos_token_id=tokenizer.eos_token_id,
)
response = tokenizer.decode(outputs[0])
print(response)
Downloads last month
11
Safetensors
Model size
70.8M params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Mxode/NanoLM-70M-Instruct-v1

Quantizations
2 models

Collection including Mxode/NanoLM-70M-Instruct-v1