MIT License
Copyright (c) 2025 Alexander Malik Pramono
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the βSoftwareβ), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED βAS ISβ, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Contributions are welcome! Please fork the repository, make your changes, and submit a pull request. All contributions must follow the code style of the project.
license: mit
Nano-Butterfly Model
Welcome to the Alexander27/Nano-Butterfly model card! This is a Causal Language Model trained using Hugging Face AutoTrain.
π How to Use
You can easily run this model using the transformers library.
1. Installation
First, make sure you have the required libraries installed.
pip install transformers torch
2. Run the Model in Python
Save the following code as a Python file (e.g., app.py) and run it.
from transformers import AutoTokenizer, AutoModelForCausalLM
# The name of your model on the Hugging Face Hub
model_name = "Alexander27/Nano-Butterfly"
# Load the tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
# Define the prompt
prompt = "The future of artificial intelligence is "
# Prepare the input for the model
input_ids = tokenizer.encode(prompt, return_tensors="pt")
# Generate text
output_sequences = model.generate(
input_ids=input_ids,
max_length=100,
num_return_sequences=1
)
# Decode the output and print it
generated_text = tokenizer.decode(output_sequences[0], skip_special_tokens=True)
print(generated_text)
Alternative in python:
File: app.py
1. Install necessary libraries
In your terminal, run: pip install transformers torch
from transformers import AutoTokenizer, AutoModelForCausalLM
The name of your model on the Hugging Face Hub
model_name = "Alexander27/Nano-Butterfly"
2. Load the tokenizer and model
print(f"Loading model: {model_name}") tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name) print("Model loaded successfully!")
3. Define the prompt (the input text for the model)
prompt = "The future of artificial intelligence is "
4. Prepare the input for the model
input_ids = tokenizer.encode(prompt, return_tensors="pt")
5. Generate text
max_length controls how long the output will be
output_sequences = model.generate( input_ids=input_ids, max_length=100, num_return_sequences=1 )
6. Decode the output and print it
generated_text = tokenizer.decode(output_sequences[0], skip_special_tokens=True)
print("\n--- Model Output ---") print(generated_text)