오라마
Ollama는 Llama, Mistral 및 CodeLlama와 같은 AI 모델에 대한 개인 정보 보호, 제어 및 오프라인 액세스를 제공하는 기계에 로컬로 큰 언어 모델을 실행하기위한 도구입니다.
설치 및 설치
Command |
Description |
curl -fsSL https://ollama.ai/install.sh \| sh |
Install Ollama on Linux/macOS |
brew install ollama |
Install via Homebrew (macOS) |
ollama --version |
Check installed version |
ollama serve |
Start Ollama server |
ollama ps |
List running models |
ollama list |
List installed models |
모델 관리
Command |
Description |
ollama pull llama3.1 |
Download Llama 3.1 model |
ollama pull mistral |
Download Mistral model |
ollama pull codellama |
Download CodeLlama model |
ollama pull gemma:7b |
Download specific model size |
ollama show llama3.1 |
Show model information |
ollama rm mistral |
Remove model |
인기 모델
일반 목적 모델
Command |
Description |
ollama pull llama3.1:8b |
Llama 3.1 8B parameters |
ollama pull llama3.1:70b |
Llama 3.1 70B parameters |
ollama pull mistral:7b |
Mistral 7B model |
ollama pull mixtral:8x7b |
Mixtral 8x7B mixture of experts |
ollama pull gemma:7b |
Google Gemma 7B |
ollama pull phi3:mini |
Microsoft Phi-3 Mini |
Code-특별화 모델 번호:
Command |
Description |
ollama pull codellama:7b |
CodeLlama 7B for coding |
ollama pull codellama:13b |
CodeLlama 13B for coding |
ollama pull codegemma:7b |
CodeGemma for code generation |
ollama pull deepseek-coder:6.7b |
DeepSeek Coder model |
ollama pull starcoder2:7b |
StarCoder2 for code |
특수 모델
Command |
Description |
ollama pull llava:7b |
LLaVA multimodal model |
ollama pull nomic-embed-text |
Text embedding model |
ollama pull all-minilm |
Sentence embedding model |
ollama pull mxbai-embed-large |
Large embedding model |
실행 모델
Command |
Description |
ollama run llama3.1 |
Start interactive chat with Llama 3.1 |
ollama run mistral "Hello, how are you?" |
Single prompt to Mistral |
ollama run codellama "Write a Python function" |
Code generation with CodeLlama |
ollama run llava "Describe this image" --image photo.jpg |
Multimodal with image |
채팅 인터페이스
Command |
Description |
ollama run llama3.1 |
Start interactive chat |
/bye |
Exit chat session |
/clear |
Clear chat history |
/save chat.txt |
Save chat to file |
/load chat.txt |
Load chat from file |
/multiline |
Enable multiline input |
사이트맵 제품 정보
REST API를
Command |
Description |
curl http://localhost:11434/api/generate -d '{"model":"llama3.1","prompt":"Hello"}' |
Generate text via API |
curl http://localhost:11434/api/chat -d '{"model":"llama3.1","messages":[{"role":"user","content":"Hello"}]}' |
Chat via API |
curl http://localhost:11434/api/tags |
List models via API |
curl http://localhost:11434/api/show -d '{"name":"llama3.1"}' |
Show model info via API |
스트리밍 응답
Command |
Description |
curl http://localhost:11434/api/generate -d '{"model":"llama3.1","prompt":"Hello","stream":true}' |
Stream response |
curl http://localhost:11434/api/chat -d '{"model":"llama3.1","messages":[{"role":"user","content":"Hello"}],"stream":true}' |
Stream chat |
모델 구성
온도와 모수
Command |
Description |
ollama run llama3.1 --temperature 0.7 |
Set temperature |
ollama run llama3.1 --top-p 0.9 |
Set top-p sampling |
ollama run llama3.1 --top-k 40 |
Set top-k sampling |
ollama run llama3.1 --repeat-penalty 1.1 |
Set repeat penalty |
ollama run llama3.1 --seed 42 |
Set random seed |
텍스트 및 메모리
Command |
Description |
ollama run llama3.1 --ctx-size 4096 |
Set context window size |
ollama run llama3.1 --batch-size 512 |
Set batch size |
ollama run llama3.1 --threads 8 |
Set number of threads |
주문 모형
Modelfiles 만들기
Command |
Description |
ollama create mymodel -f Modelfile |
Create custom model |
ollama create mymodel -f Modelfile --quantize q4_0 |
Create with quantization |
Modelfile 예제
카지노사이트
카지노사이트
통합 예제
Python 통합
카지노사이트
JavaScript 통합
카지노사이트
Bash 통합
카지노사이트
성능 최적화
Command |
Description |
ollama run llama3.1 --gpu-layers 32 |
Use GPU acceleration |
ollama run llama3.1 --memory-limit 8GB |
Set memory limit |
ollama run llama3.1 --cpu-threads 8 |
Set CPU threads |
ollama run llama3.1 --batch-size 1024 |
Optimize batch size |
환경 변수
Variable |
Description |
OLLAMA_HOST |
Set server host (default: 127.0.0.1:11434) |
OLLAMA_MODELS |
Set models directory |
OLLAMA_NUM_PARALLEL |
Number of parallel requests |
OLLAMA_MAX_LOADED_MODELS |
Max models in memory |
OLLAMA_FLASH_ATTENTION |
Enable flash attention |
OLLAMA_GPU_OVERHEAD |
GPU memory overhead |
Docker 사용법
Command |
Description |
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama |
Run Ollama in Docker |
docker exec -it ollama ollama run llama3.1 |
Run model in container |
docker exec -it ollama ollama pull mistral |
Pull model in container |
Docker 컴파일
카지노사이트
모니터링 및 디버깅
Command |
Description |
ollama logs |
View Ollama logs |
ollama ps |
Show running models and memory usage |
curl http://localhost:11434/api/version |
Check API version |
curl http://localhost:11434/api/tags |
List available models |
모형 Quantization
Command |
Description |
ollama create mymodel -f Modelfile --quantize q4_0 |
4-bit quantization |
ollama create mymodel -f Modelfile --quantize q5_0 |
5-bit quantization |
ollama create mymodel -f Modelfile --quantize q8_0 |
8-bit quantization |
ollama create mymodel -f Modelfile --quantize f16 |
16-bit float |
Embedding 모형
Command |
Description |
ollama pull nomic-embed-text |
Pull text embedding model |
curl http://localhost:11434/api/embeddings -d '{"model":"nomic-embed-text","prompt":"Hello world"}' |
Generate embeddings |
문제 해결
Command |
Description |
ollama --help |
Show help information |
ollama serve --help |
Show server options |
ps aux \| grep ollama |
Check if Ollama is running |
lsof -i :11434 |
Check port usage |
ollama rm --all |
Remove all models |
최고의 연습
- 유효한 렘 (7B ≈ 4GB, 13B ≈ 8GB, 70B ≈ 40GB에 근거를 둔 모형 크기를 선택하십시오)
- 더 나은 성능을 위해 사용할 때 GPU 가속
- API 통합에서 적절한 오류 처리 구현
- 여러 모델을 실행할 때 메모리 사용 모니터
- 리소스 기반 환경에 적합한 모델 사용
- Cache 자주 사용하는 모델 Locally
- 사용 사례에 적합한 컨텍스트 크기를 설정
- 긴 응답에 대한 스트리밍을 사용하여 사용자 경험을 향상
- 생산 API 사용 제한률
- 향상된 성능과 기능을 위한 모델 업데이트
일반적인 사용 사례
코드 생성
카지노사이트
텍스트 분석
카지노사이트
크리에이티브 글쓰기
카지노사이트
데이터 처리
카지노사이트