Text Generation
PyTorch
GGUF
Hindi
English
foundational-model
scratch-training
llama-architecture
hinglish
ramayana
mahabharata
Instructions to use namanadep/foundational-llama-scratch-epic-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use namanadep/foundational-llama-scratch-epic-model with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf namanadep/foundational-llama-scratch-epic-model # Run inference directly in the terminal: llama cli -hf namanadep/foundational-llama-scratch-epic-model
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf namanadep/foundational-llama-scratch-epic-model # Run inference directly in the terminal: llama cli -hf namanadep/foundational-llama-scratch-epic-model
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 namanadep/foundational-llama-scratch-epic-model # Run inference directly in the terminal: ./llama-cli -hf namanadep/foundational-llama-scratch-epic-model
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 namanadep/foundational-llama-scratch-epic-model # Run inference directly in the terminal: ./build/bin/llama-cli -hf namanadep/foundational-llama-scratch-epic-model
Use Docker
docker model run hf.co/namanadep/foundational-llama-scratch-epic-model
- LM Studio
- Jan
- vLLM
How to use namanadep/foundational-llama-scratch-epic-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "namanadep/foundational-llama-scratch-epic-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "namanadep/foundational-llama-scratch-epic-model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/namanadep/foundational-llama-scratch-epic-model
- Ollama
How to use namanadep/foundational-llama-scratch-epic-model with Ollama:
ollama run hf.co/namanadep/foundational-llama-scratch-epic-model
- Unsloth Studio
How to use namanadep/foundational-llama-scratch-epic-model 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 namanadep/foundational-llama-scratch-epic-model 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 namanadep/foundational-llama-scratch-epic-model to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for namanadep/foundational-llama-scratch-epic-model to start chatting
- Docker Model Runner
How to use namanadep/foundational-llama-scratch-epic-model with Docker Model Runner:
docker model run hf.co/namanadep/foundational-llama-scratch-epic-model
- Lemonade
How to use namanadep/foundational-llama-scratch-epic-model with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull namanadep/foundational-llama-scratch-epic-model
Run and chat with the model
lemonade run user.foundational-llama-scratch-epic-model-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
File size: 1,406 Bytes
54a634f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | import os
import sys
import torch
import torch.nn.functional as F
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from model.model import ModelConfig, Transformer
def generate(model: Transformer, prompt_tokens: torch.Tensor, max_new_tokens: int = 50, temperature: float = 0.8, top_k: int = 40):
model.eval()
tokens = prompt_tokens.clone()
with torch.no_grad():
for _ in range(max_new_tokens):
logits = model(tokens)
logits = logits[:, -1, :] / temperature
if top_k is not None:
v, _ = torch.topk(logits, min(top_k, logits.size(-1)))
logits[logits < v[:, [-1]]] = -float('Inf')
probs = F.softmax(logits, dim=-1)
next_token = torch.multinomial(probs, num_samples=1)
tokens = torch.cat((tokens, next_token), dim=1)
return tokens
if __name__ == "__main__":
device = "cuda" if torch.cuda.is_available() else "cpu"
config = ModelConfig.get_125m()
model = Transformer(config).to(device)
dummy_input = torch.randint(0, config.vocab_size, (1, 10), device=device)
print("Generating sample sequence from model...")
output = generate(model, dummy_input, max_new_tokens=20)
print(f"Generated Tokens Shape: {output.shape}")
print(f"Generated Token IDs: {output[0].tolist()}")
|