Views
No views yet
| Parameter | Value |
|---|---|
| Parameters | 124M |
| Layers | 12 |
| Hidden Size | 768 |
| Attention Heads | 12 |
| Context Length | 1024 |
| Vocabulary Size | 50,304 |
| Activation Function | GELU (tanh approximation) |
| Position Embeddings | Learned |
| Layer Norm | Pre-normalization |
| Attention Type | Multi-head with Flash Attention |
| Weight Tying | Token embeddings tied with output projection |
| Benchmark | Score |
|---|---|
| HellaSwag | 32.4% |
| Final Loss | 2.85 |
| Perplexity | ~17.3 |
1# Clone the repository
2git clone https://github.com/Kaileh57/Ursa_Minor_Smashed.git
3cd Ursa_Minor_Smashed
4
5# Set up CPU environment
6pip install -r requirements.txt
7# or use the setup script: ./setup.sh1# Use the automated CUDA setup script
2chmod +x setup-cuda.sh
3./setup-cuda.sh1# Use the Windows CUDA setup script
2setup-cuda.bat1# Create separate CUDA environment
2python -m venv venv-cuda
3source venv-cuda/bin/activate # On Windows: venv-cuda\Scripts\activate
4
5# Install CUDA requirements
6pip install -r requirements-cuda.txt1# Basic text generation
2python inference_cuda.py --prompt "Hello, I'm a language model" --max-tokens 50
3
4# Creative writing
5python inference_cuda.py --prompt "Once upon a time" --max-tokens 200 --temperature 0.9
6
7# More focused output
8python inference_cuda.py --prompt "The key to machine learning is" --max-tokens 100 --temperature 0.7 --top-k 501# Basic text generation
2python inference_cpu.py --prompt "Hello, I'm a language model" --max-tokens 50
3
4# Creative writing
5python inference_cpu.py --prompt "Once upon a time" --max-tokens 120 --temperature 0.9
6
7# More focused output
8python inference_cpu.py --prompt "The key to machine learning is" --max-tokens 80 --temperature 0.7 --top-k 301from inference_cuda import generate_direct, load_model_direct
2
3# Load model once (requires CUDA)
4model = load_model_direct("model_optimized.pt")
5
6# Generate text with CUDA optimizations
7result = generate_direct(
8 model,
9 "Hello, I'm a language model",
10 max_new_tokens=100, # Higher tokens for GPU
11 temperature=0.8,
12 top_k=50 # Higher top_k for better quality
13)
14print(result)1from inference_cpu import generate_direct, load_model_direct
2
3# Load model once (CPU only)
4model = load_model_direct("model_optimized.pt")
5
6# Generate text with CPU optimizations
7result = generate_direct(
8 model,
9 "Hello, I'm a language model",
10 max_new_tokens=80, # Lower tokens for CPU efficiency
11 temperature=0.8,
12 top_k=30 # Lower top_k for CPU efficiency
13)
14print(result)1# Start CUDA-optimized chat
2python chat_cuda.py1# Start CPU-optimized chat
2python chat_cpu.py1@misc{ursa-minor-smashed,
2 author = {Kaileh57},
3 title = {Ursa Minor Smashed: Efficient GPT-2 Training},
4 year = {2024},
5 url = {https://github.com/Kaileh57/Ursa_Minor_Smashed}
6}inference_cuda.py - CUDA-optimized inference scriptinference_cpu.py - CPU-optimized inference scriptchat_cuda.py - CUDA-optimized chat interfacechat_cpu.py - CPU-optimized chat interfacebenchmark_cuda.py - CUDA performance benchmarking toolbenchmark_cpu.py - CPU performance benchmarking toolconvert_to_gguf.py - Convert to GGUF format for llama.cppexamples/basic_usage_cuda.py - CUDA usage examplesexamples/basic_usage_cpu.py - CPU usage examplestemperature (0.1-1.0): Controls randomness (lower = more focused)top_k (1-100): Limit to top-k most likely tokenstop_p (0.1-1.0): Nucleus sampling thresholdrepetition_penalty (1.0-2.0): Reduce repetitive outputmax_tokens: Maximum tokens to generate