Instructions to use rinarina0429/pruned-llama2-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rinarina0429/pruned-llama2-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rinarina0429/pruned-llama2-7b")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("rinarina0429/pruned-llama2-7b", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use rinarina0429/pruned-llama2-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rinarina0429/pruned-llama2-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rinarina0429/pruned-llama2-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/rinarina0429/pruned-llama2-7b
- SGLang
How to use rinarina0429/pruned-llama2-7b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "rinarina0429/pruned-llama2-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rinarina0429/pruned-llama2-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "rinarina0429/pruned-llama2-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rinarina0429/pruned-llama2-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use rinarina0429/pruned-llama2-7b with Docker Model Runner:
docker model run hf.co/rinarina0429/pruned-llama2-7b
pruned-llama2-7b
모델 설명
이 모델은 Progressive Loading을 지원하는 프루닝된 LLaMA 모델입니다.
파일 구조
P.safetensors: 주요 레이어들 (프루닝된 모델의 핵심 부분)R1.safetensors: 복원 레이어 그룹 1R2.safetensors: 복원 레이어 그룹 2manifest.json: 레이어 매핑 정보 및 메타데이터original_config/: 원본 모델 설정 및 토크나이저prune_map.json: 프루닝 맵 정보
사용 방법
Progressive Loading으로 모델 로드
from hf_progressive_loader import HuggingFaceProgressiveLoader
허깅페이스에서 직접 로딩
loader = HuggingFaceProgressiveLoader("rinarina0429/pruned-llama2-7b")
model, tokenizer = loader.progressive_stage_loading("cuda")
추론
inputs = tokenizer("Hello world!", return_tensors="pt")
if torch.cuda.is_available():
inputs = {k: v.to("cuda") for k, v in inputs.items()}
model.eval()
with torch.no_grad():
outputs = model(**inputs)
print(outputs.logits.shape)
text
## 성능
- **전체 로딩 시간**: 15-30초 (GPU 환경)
- **메모리 효율성**: 단계적 로딩으로 메모리 절약
- **캐시 지원**: 두 번째 로딩부터 빠른 속도
## 라이선스
MIT License