Windows: Use Docker or WSL2 (Windows Subsystem for Linux).
Docker installed: Ollama relies on Docker to run models.
Step 1: Create a Configuration File
Create a .toml configuration file for CodeLlama 13B. For example, create a file named codellama-13b.toml with the following content:
toml
name = "codellama-13b"
version = 1
base = "aubergine-ai/codellama:13b"
entrypoint = ["python", "-m", "serve"]
model {
type = "huggingface"
path = "codellama/CodeLlama-13b-hf"
tokenizer = "codellama/CodeLlama-13b-hf"
revision = "main"
}
system_prompt = """
You are CodeLlama, a large language model specialized in coding.
Answer as concisely as possible and avoid unnecessary text.
"""
# Optional: Adjust parameters like temperature, max_tokens, etc.
parameters {
temperature = 0.7
max_new_tokens = 512
}
Step 2: Build the Model
Run the following command to build the model in Ollama:
bash
ollama build codellama-13b
This will:
Download the CodeLlama 13B model from Hugging Face (via Docker).
Configure it using the parameters in your .toml file.
Make the model available for use in Ollama.
Step 3: Verify Installation
Test the model by querying it:
bash
ollama run codellama-13b "Hello, how can you help me with MQL4 scripts?"
You should get a response like:
"I can help you write, debug, and optimize MQL4 scripts for MetaTrader 4. Just provide details about what you need, and I'll assist!"
Troubleshooting Tips
Docker Permissions: If you encounter permission errors, ensure Docker is running and you have the correct permissions.
Model Availability: Verify the Docker image aubergine-ai/codellama:13b exists here. If not, check for updates or use an alternative base image.
Storage Space: CodeLlama 13B requires ~13 GB of storage. Ensure your machine has enough free space.
Optional: Use Pre-Built Models
If you prefer not to build from scratch, check if Ollama already supports CodeLlama via its registry:
bash
ollama list
If available, you can pull it directly:
bash
ollama pull codellama-13b
Once installed, you can use CodeLlama 13B in Ollama for MQL4 scripting, coding assistance, or any other tasks. For example:
bash
ollama run codellama-13b "Write an MQL4 script for a moving average crossover strategy."