--- license: gemma library_name: transformers pipeline_tag: text-generation extra_gated_heading: Access Gemma on Hugging Face extra_gated_prompt: >- To access Gemma on Hugging Face, you’re required to review and agree to Google’s usage license. To do this, please ensure you’re logged in to Hugging Face and click below. Requests are processed immediately. extra_gated_button_content: Acknowledge license tags: - conversational base_model: - google/gemma-3-270m-it --- # gemma3-270m-it-sms-verification_code_extraction #### SMS에서 인증번호를 추출 하는 gemma3 SFT 모델 - 모바일 내장을 위한 Quantization 모델입니다. 일반 모델은 아래 링크를 참조해주세요 - https://huggingface.co/sg2023/gemma3-270m-it-sms-verification_code_extraction - Input / Output - `"본인인증번호는 315611 입니다. 정확히 입력해주세요."` -> `315611` - `"안녕하세요"` -> `0` ```python from transformers import Gemma3ForCausalLM, AutoTokenizer repo_id = "sg2023/gemma3-270m-it-sms-verification_code_extraction" tokenizer = AutoTokenizer.from_pretrained(repo_id) model = Gemma3ForCausalLM.from_pretrained(repo_id) model.eval() prompt = "본인인증번호는 315611 입니다. 정확히 입력해주세요." request_template = [{"role": "user", "content": prompt}] response_template = tokenizer.apply_chat_template(request_template, tokenize=False, add_generation_prompt=True) inputs = tokenizer(response_template, return_tensors="pt").to(model.device) input_ids = inputs["input_ids"][0] # Tensor shape: (seq_len,) input_len = input_ids.shape[0] outputs = model.generate(**inputs, max_new_tokens=64)[0] outputs = outputs[input_len:] outputs = tokenizer.decode(outputs, skip_special_tokens=True) outputs = outputs.strip() print(outputs) # 315611 ```