Ollama දේශීය විශාල භාෂා ආකෘති (LLMs) ක්රියාත්මක කිරීම සඳහා සම්මත බවට පත් වී ඇත. මෙම උපාංගය තුළ, මම ඔබ Ollama ගැන දැනගත යුතු වැදගත්ම දේවල් ඔබට පෙන්වන්න කැමතියි. https://youtu.be/AGAETsxjg0o?embedable=true YouTube මත බලන්න: Ollama Full Tutorial Youtube එක බලන්න : Ollama Full Tutorial සම්පූර්ණ Tutorial සම්පූර්ණ Tutorial Ollama යනු කුමක්ද? Ollama ඔබේ දේශීය පරිගණකය මත සම්පූර්ණයෙන්ම විශාල භාෂා ආකෘති (LLM) පැකේජයන් ක්රියාත්මක කිරීම සහ කළමනාකරණය කිරීම සඳහා විවෘත මූලාශ්ර පද්ධතියකි. එය ආකෘති බර, සැකසුම් සහ දත්ත එක් ආකෘති ගොනු පැකේජයකට එකතු කරයි. Ollama ආකෘති පරිගණකය (CLI), REST API සහ Python/JavaScript SDK ඉදිරිපත් කරයි, භාවිතා කරන්නන්ට ආකෘති බාගත කිරීමට, ඒවා ඔන්ලයින් ක්රියාත්මක කිරීමට සහ පවා පරිශීලක විසින් සකස් කරන කාර්යයන් ඇමතුම් කිරීමට ඉඩ සලසයි. Ollama ස්ථාපනය Ollama බාගත කිරීම සඳහා නිල වෙබ් අඩවිය වෙත යන්න එය M සඳහා ලබා ගත හැකිය https://ollama.com/ ac, Windows, and Linux. https://ollama.com/ ලින්ක්ස් : curl -fsSL https://ollama.com/install.sh | sh මැක්ස් : brew install ollama වින්ඩෝස්: Download ඒක install කරලා run කරන්න. .exe Ollama ක්රියා කරන්නේ කෙසේද ආකෘති ක්රියාත්මක කිරීමට පෙර, Quantization තේරුම් ගැනීම අත් යවශ් ය වේ.Ollama සාමාන්යයෙන් ආකෘති ක්රියාත්මක කිරීම 4 බයිට් (q4_0) දක්වා ක්රියාත්මක කරයි, එය ගුණාත්මක අහිමි වීමෙන් මතකය භාවිතය පුළුල් ලෙස අඩු කරයි. Recommended Hardware: 7B ආකෘති (උදාහරණයක් ලෙස, Llama 3, Mistral): ~8GB RAM අවශ්ය (අද බොහෝ පරිගණක මත ක්රියාත්මක වේ). 13B — 30B ආකෘති: අවශ්ය 16GB — 32GB RAM. 70B+ ආකෘති: 64GB+ RAM හෝ Dual GPU අවශ්ය වේ. GPU: වේගය සඳහා NVIDIA GPU හෝ Apple Silicon (M1/M2/M3) ඉතා නිර්දේශ කර ඇත. යන්න "Models" මත ක්ලික් කරන්න සහ ඔබේ ටෙස්ට් සඳහා මොඩියුලය තෝරා ගන්න. Ollama වෙබ් අඩවිය Ollama වෙබ් අඩවිය ඉන්පසු, ආකෘති නාමය මත ක්ලික් කරන්න සහ අංකය සංකේතය සකස් කරන්න: ඉන්පසු Terminal Window එක විවෘත කර Command එක ඇතුලත් කරන්න: එය ඔබට වහාම ආකෘතිය සමඟ බාගත හා චැට් කිරීමට ඉඩ දෙනු ඇත. Ollama CLI – Core Commands Ollama හි CLI යනු ආකෘති කළමනාකරණය සඳහා මධ් යම වේ. ඩෙංගු ටීචර් <model> — Download a model ollama run <model> — ආකෘතිය ක්රියාත්මකව ක්රියාත්මක කරන්න ollama list or ollama ls — Downloaded models ලැයිස්තුව ollama rm <model> — ආකෘතිය ඉවත් කිරීම ollama create -f <Modelfile> — Custom model නිර්මාණය කිරීම ollama serve — Ollama API සේවාදායකය ආරම්භ කිරීම ollama ps — Show running models (අදාල පින්තූර බලන්න) ollama stop <model> — ක් රියාත්මක වන ආකෘතිය නතර කිරීම සහාය පෙන්වන්න - help Advanced Customization: Modelfiles සමඟ Custom model ඔබ Modelfile භාවිතා කිරීමෙන් ආකෘතියගේ පෞද්ගලිකත්වය සහ සීමාවන් "සහගත කළ හැකිය.This is similar to a Dockerfile. ModelFile නමැති ගොනුවක් නිර්මාණය කිරීම ඊළඟ Configuration එක එකතු කරන්න: # 1. Base the model on an existing one FROM llama3 # 2. Set the creative temperature (0.0 = precise, 1.0 = creative) PARAMETER temperature 0.7 # 3. Set the context window size (default is 4096 tokens) PARAMETER num_ctx 4096 # 4. Define the System Prompt (The AI’s “brain”) SYSTEM """ You are a Senior Python Backend Engineer. Only answer with code snippets and brief technical explanations. Do not be conversational. """ මූලික ආකෘතිය සකස් කිරීම FROM ඉක්මණින් පද්ධතිය සකස් කරන්න SYSTEM Inference Behavior පාලනය කිරීම PARAMETER ඉන්පසු, ඔබට මෙම නියෝගයක් භාවිතා කිරීමෙන් ආකෘතිය ගොඩනඟා ගත යුතුය: ollama create [change-to-your-custom-name] -f Modelfile මෙය model + prompt template එකතුවෙන් නැවත පාවිච්චි කළ හැකි package එකක් බවට පත් කරයි. ඉන්පසු Run in: ollama run [change-to-your-custom-name] Click or enter to view full image මුළු ප් රමාණයම බලන්න Ollama සේවාදායක (Local API) Ollama ස්ථාපිත සේවාදායකයක් ලෙස ක්රියාත්මක කළ හැකිය, එය යෙදුම් ඇමතුම් කළ හැකිය.To start the server use the command: ollama serve එය http://localhost:11434 මත සවිකරයි. HTTP උපකරණ import requests r = requests.post( "http://localhost:11434/api/chat", json={ "model": "llama3", "messages": [{"role":"user","content":"Hello Ollama"}] } ) print(r.json()["message"]["content"]) මෙය ඔබට යෙදුම් හෝ සේවා වලට Ollama ඇතුළත් කිරීමට ඉඩ සලසයි. Python සම්බන්ධතා Official library සමග Python යෙදුම් තුළ Ollama භාවිතා කරන්න. Virtual Environments නිර්මාණය කිරීම සහ ක්රියාත්මක කිරීම: python3 -m venv .venv source .venv/bin/activate නිල පුස්තකාලය ස්ථාපනය කිරීම: pip install ollama මෙම සරල Python කේතය භාවිතා කරන්න: import ollama # This sends a message to the model 'gemma:2b' response = ollama.chat(model='gemma:2b', messages=[ { 'role': 'user', 'content': 'Write a short poem about coding.' }, ]) # Print the AI's reply print(response['message']['content']) මෙය Ollama ක්රියා කරන විට ස්වයංක්රීයව දේශීය API හරහා ක්රියා කරයි. You can also call a local server: import requests r = requests.post( "http://localhost:11434/api/chat", json={ "model": "llama3", "messages": [{"role":"user","content":"Hello Ollama"}] } ) print(r.json()["message"]["content"]) Ollama Cloud භාවිතා කිරීම Ollama ද වලාකුළු ආකෘති සහාය - ඔබගේ යන්ත්රය ඉතා විශාල ආකෘති ක්රියා කළ නොහැකි විට ප්රයෝජනවත්. මුලින්ම account එකක් හදන්න ඉන්පසු, ආකෘති පිටුවේ ඇතුළත, e ක්ලික් කරන්න සහ ඔබ පරීක්ෂා කිරීමට අවශ්ය ඕනෑම ආකෘතිය තෝරන්න. https://ollama.com/cloud https://ollama.com/cloud model ලැයිස්තුවේ, ඔබ දකිනවා model with the ප්රවර්ගය**,** යනුවෙන් එය Ollama Cloud හි ලබා ගත හැකිය. -cloud Click on it and copy the CLI command. Then, inside the terminal, use: ඉන්පසු CLI command එක copy කරන්න. ollama signin ඔබගේ Ollama ගිණුමට ලියාපදිංචි කිරීමට. ollama signnin සමඟ ලියාපදිංචි වූ පසු, එවිට cloud models ක්රියාත්මක කරන්න: ollama run nemotron-3-nano:30b-cloud ඔබේම ආකෘතිය Cloud හි Ollama local-first වන අතර, Ollama Cloud ඔබට ඔබගේ පෞද්ගලික ආකෘති (ඔබ Modelfiles සමඟ නිර්මාණය කරන අය) ඔබේ කණ්ඩායම සමඟ බෙදා ගැනීමට හෝ උපකරණ ගණනාවක් හරහා භාවිතා කිරීමට අන්තර්ජාලයට දැමීමට ඉඩ සලසයි. ollama.com හි ගිණුමක් නිර්මාණය කරන්න. ඔබගේ පොදු යතුර එකතු කරන්න (found in ~/.ollama/id_ed25519.pub) ඔබේ custom model එක තල්ලු කරන්න: ollama push your-username/change-to-your-custom-model-name ප් රතිඵල ඒ Ollama සම්පූර්ණ සමාලෝචනයයි! එය ඔබට AI පිළිබඳ සම්පූර්ණ පාලනය ලබා දෙන බලවත් මෙවලමක් වේ. ඔබ මෙම උපාංගය කැමති නම්, කරුණාකර එය කැමතියි සහ පහත කොටස තුළ ඔබේ ප්රතිචාර බෙදා ගන්න. සුබ පැතුම් ;)