YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Bard β€” trained from scratch, pushed to Hugging Face

A complete, minimal project: a custom tokenizer, a small Transformer built by hand, a training loop, and a script to publish the result to the Hugging Face Hub.

Files

File What it does
tokenizer.py A word-level tokenizer that learns its own vocabulary from your text β€” no external files.
model.py A small Transformer encoder classifier, wrapped as a proper Hugging Face PreTrainedModel.
sample_data.csv 50 labeled example sentences (positive/negative) to get you started.
train.py Trains the model from scratch on sample_data.csv.
push_to_hub.py Uploads your trained model to huggingface.co.
MODEL_CARD.md Becomes the model's README on the Hub.

Steps

  1. Install dependencies (locally, or in a free Colab notebook β€” training is small and fast even on CPU):

    pip install -r requirements.txt
    
  2. (Optional) Replace sample_data.csv with your own data. Keep the same two columns: text,label (label is 0 or 1). More rows = a better model β€” even a few hundred makes a real difference.

  3. Train:

    python train.py
    

    This prints loss/accuracy per epoch and saves the trained model to tiny-sentiment-model/.

  4. Create a Hugging Face account and access token, if you don't have one: https://huggingface.co/join, then https://huggingface.co/settings/tokens (create a token with "write" access).

  5. Log in from the terminal:

    huggingface-cli login
    
  6. Edit REPO_ID in push_to_hub.py to "your-username/tiny-sentiment-model".

  7. Push it:

    python push_to_hub.py
    

    Your model will be live at https://huggingface.co/your-username/tiny-sentiment-model.

Notes

  • This model is trained fully from scratch (random weight initialization) β€” it does not fine-tune any existing pretrained model. That keeps it small and fast to train, but it will need more data than the 50-row sample to get genuinely good at sentiment analysis.
  • Because the model is a custom architecture, anyone loading it later needs model.py alongside the checkpoint (or you can add trust_remote_code support β€” ask if you'd like help setting that up so AutoModel.from_pretrained(...) works without the file).
  • Want to go bigger later? The same pattern (config + PreTrainedModel) scales up β€” just increase hidden_size, num_layers, and dataset size.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support