Instructions to use CharacterEcho/Narendra-Modi with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CharacterEcho/Narendra-Modi with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CharacterEcho/Narendra-Modi") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CharacterEcho/Narendra-Modi") model = AutoModelForCausalLM.from_pretrained("CharacterEcho/Narendra-Modi") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - llama-cpp-python
How to use CharacterEcho/Narendra-Modi with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="CharacterEcho/Narendra-Modi", filename="narendra-modi-iq4_xs-imat.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use CharacterEcho/Narendra-Modi with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf CharacterEcho/Narendra-Modi:IQ4_XS # Run inference directly in the terminal: llama-cli -hf CharacterEcho/Narendra-Modi:IQ4_XS
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf CharacterEcho/Narendra-Modi:IQ4_XS # Run inference directly in the terminal: llama-cli -hf CharacterEcho/Narendra-Modi:IQ4_XS
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf CharacterEcho/Narendra-Modi:IQ4_XS # Run inference directly in the terminal: ./llama-cli -hf CharacterEcho/Narendra-Modi:IQ4_XS
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf CharacterEcho/Narendra-Modi:IQ4_XS # Run inference directly in the terminal: ./build/bin/llama-cli -hf CharacterEcho/Narendra-Modi:IQ4_XS
Use Docker
docker model run hf.co/CharacterEcho/Narendra-Modi:IQ4_XS
- LM Studio
- Jan
- vLLM
How to use CharacterEcho/Narendra-Modi with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CharacterEcho/Narendra-Modi" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CharacterEcho/Narendra-Modi", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CharacterEcho/Narendra-Modi:IQ4_XS
- SGLang
How to use CharacterEcho/Narendra-Modi with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "CharacterEcho/Narendra-Modi" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CharacterEcho/Narendra-Modi", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "CharacterEcho/Narendra-Modi" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CharacterEcho/Narendra-Modi", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use CharacterEcho/Narendra-Modi with Ollama:
ollama run hf.co/CharacterEcho/Narendra-Modi:IQ4_XS
- Unsloth Studio new
How to use CharacterEcho/Narendra-Modi with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for CharacterEcho/Narendra-Modi to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for CharacterEcho/Narendra-Modi to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for CharacterEcho/Narendra-Modi to start chatting
- Docker Model Runner
How to use CharacterEcho/Narendra-Modi with Docker Model Runner:
docker model run hf.co/CharacterEcho/Narendra-Modi:IQ4_XS
- Lemonade
How to use CharacterEcho/Narendra-Modi with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull CharacterEcho/Narendra-Modi:IQ4_XS
Run and chat with the model
lemonade run user.Narendra-Modi-IQ4_XS
List all available models
lemonade list
Run and chat with the model
lemonade run user.Narendra-Modi-IQ4_XSList all available models
lemonade listCharacterEcho / Narendra Modi
Model Description
The Narendra Modi AI model, developed by CharacterEcho, is trained to emulate the personality and speech patterns of Narendra Modi, the Prime Minister of India. This model is designed to generate text that mirrors Modi's style of communication, including his speeches, interviews, and public statements.
Model Details
- Creator: CharacterEcho
- Language: English
- Library: Transformers
- Pipeline Tag: Text Generation
- License: apache-2.0
- Model Size: 2.8B params
- Tensor Type: FP16
How to Use
You can use this model in your projects by following the instructions below:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
# Load the Narendra Modi model
model = AutoModelForCausalLM.from_pretrained("CharacterEcho/Narendra-Modi").to("cuda")
# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained("CharacterEcho/Narendra-Modi")
# Setup the TextStreamer for smooth conversation flow
streamer = TextStreamer(tokenizer)
prompt = """
<|im_start|>system: {system}
<|im_end|>
<|im_start|>user: {insaan}
<|im_end|>
<|im_start|>assistant:
"""
# Define the system prompt for the AI to role-play as Narendra Modi
system = "You are Narendra Modi, the Prime Minister of India known for your impactful speeches and leadership. Step into the shoes of Narendra Modi and embody his unique personality. Imagine you are addressing the nation on an important issue. Your goal is to inspire and motivate your audience while staying true to the values and vision that have made you a prominent leader. Remember, as Narendra Modi, you strive for clarity, confidence, and a strong connection with the people of India."
insaan = ""
# Now we combine system and user messages into the template, like adding sprinkles to our conversation cupcake
prompt = prompt.format(system=system, insaan=insaan)
# Time to chat! We'll use the tokenizer to translate our text into a language the model understands
inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False).to("cuda")
# Here comes the fun part! Let's unleash the power of HelpingAI-3B to generate some awesome text
generated_text = model.generate(**inputs, max_length=3084, top_p=0.95, do_sample=True, temperature=0.6, use_cache=True, streamer=streamer)
- Downloads last month
- 46
Pull the model
# Download Lemonade from https://lemonade-server.ai/lemonade pull CharacterEcho/Narendra-Modi:IQ4_XS