3.4.8 Set Parameterstraining_args = TrainingArguments( output_dir="./keywords_gemma_results", # Directory to save the model checkpoints and logs. max_steps=800, # Total number of training steps to perform. This will override `num_train_epochs`. per_device_train_batch_size=4, # The batch size used during training on each GPU/TPU. # If you have multip..
3.4.5 Generate Keyword dataChoosing the right batch_sizeModel Size and Memory (RAM/VRAM)• Smaller models (e.g., BERT) can handle larger batch sizes without running out of memory.• Larger models (e.g., GPT-based models) require more memory to process each batch. A smaller batch_size reduces the memory footprint.2. Performance and Throughput• A larger batch_size improves throughput because the mod..
3.4 단일 GPU를 활용한 Gemma-2B-it 파인튜닝Fine tune Gemma-2B-it3.4.1 Setup Runpod3.4.2 Model PreparationCreate hugging face accountCreate a TokenUse Model : https://huggingface.co/google/gemma-2b-itRun the code# Load a pretrained causal language model (e.g., GPT) using the Hugging Face Transformers library model = AutoModelForCausalLM.from_pretrained( model_name, # The name or path of the pretrained model..
3.3 GPU ParallelSome use casesData ParallelismModel ParallelismPipeline ParallelismTensor Parallelism3.3.1 Data ParallelismProcessSplit datasetDistribute dataPerform OperationsAggregate ResultsProsSame weight across all processing unitsGradients are synchronized across all unitsConsCommunication overheadUnable to use VRAM evenlyData replications might be neededSmall dataset3.3.2 Model Parallelis..
3.2 Gemma , Llama 3 model structure analysis3.2.1 GemmaReduced model sizeKey differenceLayerNorm(RMSNorm)a technique used to keep a neural network “calm and focused” during training.Calculate average size and keep gradient consistent.Typesinput_layernormpost_attention_layernormRotary Position Embedding(RoPE)RoPE solves the problem by encoding positional information into the tokens (words) so tha..
3.1 Fine tuning Data preparationTrain pre-trained LLM for specific use casesHallucination could be an issueTypesFull Fine TUningPEFT (Parameter Efficient Fine Tuning)Adapter TuningPrompt TuningLoRaBeware ofOverfittingCatastrophic ForgeettingResources to train the model above 7B .Garbage in -> Garbage outBiased dataTasks and DatasetNext token prediction -> text generationConversational TaskConcep..
2.6 Multihead attention / Feed-ForwardAttentionHelp model to focus on the important dataclass MultiHeadAttention(nn.Module): def __init__(self, num_heads, head_size): super().__init__() self.heads = nn.ModuleList([Head(head_size) for _ in range(num_heads)]) def forward(self,inputs): return torch.cat([head(inputs) for head in self.heads], dim=-1)Feed ForwardAttention ca..
주요 개념임베딩 레이어nn.Embedding은 토큰(단어/문자 등)을 고정된 크기의 벡터로 변환합니다.코드에서는 vocab_length 크기의 임베딩을 사용합니다.Forward Pass 및 손실 계산forward 메서드는 모델의 입력을 처리하고, logits(모델 출력)과 손실(loss)을 반환합니다.F.cross_entropy를 사용하여 목표(target)와의 차이를 계산합니다.시퀀스 생성generate 메서드는 현재 입력에 대해 다음 토큰을 샘플링하여 새로운 시퀀스를 생성합니다.torch.multinomial과 F.softmax를 사용하여 확률적으로 다음 토큰을 선택합니다.훈련 루프데이터를 배치 단위로 처리하며 모델을 학습시킵니다.손실이 일정 간격마다 평가됩니다.학습 데이터 배치 생성batch_fun..
Kubernetes는 현대 애플리케이션 배포에서 중요한 역할을 하지만, 여러 클러스터를 관리해야 하는 상황에서는 클러스터 간 전환이 번거로울 수 있습니다. 이때 등장하는 도구가 바로 kubectx입니다. kubectx는 여러 Kubernetes 클러스터를 간단히 전환할 수 있도록 도와주는 도구로, 효율적인 클러스터 관리에 큰 도움을 줍니다. 이 글에서는 kubectx의 개념, 사용 이유, 주요 기능, 장점, 실제 사용 예제, 설치 방법, 그리고 네임스페이스 변경 방법을 살펴보겠습니다.kubectx란?kubectx는 Kubernetes 클러스터 전환을 간편하게 만들어 주는 명령줄 도구입니다. 기본적으로 kubectl에서도 컨텍스트 전환 기능을 제공하지만, 복잡한 명령어 입력과 관리의 불편함이 존재합니다. ..
- Total
- Today
- Yesterday
- docker
- Python
- lllm
- Fine-Tuning
- error
- K8S
- kubens
- palindrome
- 책리뷰
- csv
- go
- feed-forward
- 파이썬
- Shell
- book
- Binary
- Kubernetes
- leetcode
- Gemma
- 나는리뷰어다
- 키보드
- BASIC
- Git
- Container
- LLM
- AWS
- kubernetes context
- Algorithm
- 한빛미디어
- collator
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |