Run this model with HF Jobs
Run seungbo7747/summarization_model on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/seungbo7747/summarization_model. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/seungbo7747/summarization_model on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use seungbo7747/summarization_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use seungbo7747/summarization_model with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("seungbo7747/summarization_model") model = AutoModelForSeq2SeqLM.from_pretrained("seungbo7747/summarization_model", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files59 unmodified lines60616263646559 unmodified lines| 0.6402 | 0.96 | 1200 | 0.5970 | 0.0855 | 0.0213 | 0.0854 | 0.0855 |### Framework versions- Transformers 4.51.359 unmodified lines6061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514659 unmodified lines| 0.6402 | 0.96 | 1200 | 0.5970 | 0.0855 | 0.0213 | 0.0854 | 0.0855 |### How to```pythonimport torchfrom transformers import T5TokenizerFast, T5ForConditionalGeneration# 1. λͺ¨λΈ λ° ν ν¬λμ΄μ λ‘λmodel_id = "username/my_awesome_summarization_model" # μ€μ νλΈ λͺ¨λΈ IDλ‘ λ체tokenizer = T5TokenizerFast.from_pretrained(model_id)model = T5ForConditionalGeneration.from_pretrained(model_id)# 2. GPU μ€μ (κ°λ₯ν κ²½μ°)device = torch.device("cuda" if torch.cuda.is_available() else "cpu")model.to(device)print(f"Using device: {device}")if torch.cuda.is_available():print(f"GPU name: {torch.cuda.get_device_name(0)}")# 3. μμ½ ν¨μ μ μdef summarize_text(texts, max_input_length=512, max_output_length=150, num_beams=4):"""μ£Όμ΄μ§ ν μ€νΈ 리μ€νΈλ₯Ό μμ½νλ ν¨μ.Args:texts (list[str]): μμ½ν ν μ€νΈ 리μ€νΈ (κ° ν μ€νΈλ 'summarize: ' μ λμ¬ ν¬ν¨ κ°λ₯).max_input_length (int): μ λ ₯ ν μ€νΈ μ΅λ κΈΈμ΄.max_output_length (int): μΆλ ₯ μμ½ μ΅λ κΈΈμ΄.num_beams (int): λΉ μμΉμμ μ¬μ©ν λΉ μ.Returns:list[str]: μμ½λ ν μ€νΈ 리μ€νΈ."""# μ λ ₯ ν μ€νΈμ 'summarize: ' μ λμ¬ μΆκ° (μλ κ²½μ°)inputs = [f"summarize: {text}" if not text.startswith("summarize: ") else text for text in texts]# ν ν°νtokenized_inputs = tokenizer(inputs,max_length=max_input_length,truncation=True,padding=True,return_tensors="pt")# GPUλ‘ μ λ ₯ μ΄λtokenized_inputs = {k: v.to(device) for k, v in tokenized_inputs.items()}# μμ½ μμ±summary_ids = model.generate(tokenized_inputs["input_ids"],attention_mask=tokenized_inputs["attention_mask"],max_length=max_output_length,num_beams=num_beams,early_stopping=True)# λμ½λ©summaries = tokenizer.batch_decode(summary_ids, skip_special_tokens=True)return summaries# 4. ν μ€νΈ μ λ ₯ μμtest_texts = ["summarize: νκ΅μ μλλ μμΈμ λλ€. μμΈμ νλ°λ μ€λΆμ μμΉνλ©°, μΈκ΅¬λ μ½ 970λ§ λͺ μ λλ€. μμΈμ κ²½μ , λ¬Έν, μ μΉμ μ€μ¬μ§λ‘, νκ°μ΄ λμλ₯Ό κ°λ‘μ§λ₯΄λ©° λ§μ μμ¬μ μ μ°κ³Ό νλμ 건μΆλ¬Όμ΄ 곡쑴ν©λλ€.","summarize: μΈκ³΅μ§λ₯(AI)μ μ»΄ν¨ν° μμ€ν μ΄ μΈκ°μ μ§λ₯μ λͺ¨λ°©νκ±°λ μ΄μνλλ‘ λ§λλ κΈ°μ μ λλ€. AIλ λ¨Έμ λ¬λ, λ₯λ¬λ, μμ°μ΄ μ²λ¦¬ λ±μ λΆμΌλ‘ λλλ©°, μλ£, κΈμ΅, μ μ‘° λ± λ€μν μ°μ μμ νμ©λκ³ μμ΅λλ€. κ·Έλ¬λ AIμ μ€λ¦¬μ λ¬Έμ μ μΌμ리 λ체 μ°λ €λ μ κΈ°λκ³ μμ΅λλ€.","summarize: κΈ°ν λ³νλ μ§κ΅¬ μ¨λν, ν΄μλ©΄ μμΉ, κ·Ήλ¨μ κΈ°μ νμμ μ΄λνλ κΈλ‘λ² λ¬Έμ μ λλ€. μ΄μ°ννμ λ°°μΆ κ°μμ μ¬μ κ°λ₯ μλμ§ μ¬μ©μ΄ ν΄κ²°μ± μΌλ‘ μ μλμ§λ§, κ΅μ μ νλ ₯μ΄ λΆμ‘±ν μν©μ λλ€."]# 5. μμ½ μ€ν λ° κ²°κ³Ό μΆλ ₯summaries = summarize_text(test_texts)for i, (input_text, summary) in enumerate(zip(test_texts, summaries)):print(f"\nInput {i+1}: {input_text}")print(f"Summary {i+1}: {summary}")# 6. λ¨μΌ ν μ€νΈ μμ½ μμ (κ°λ¨ν μ¬μ©)single_text = "summarize: λΈλ‘체μΈμ λΆμ°λ λμ§νΈ μ₯λΆλ‘, κ±°λ λ°μ΄ν°λ₯Ό μνΈννμ¬ λ³΄μμ±κ³Ό ν¬λͺ μ±μ μ 곡ν©λλ€. λΉνΈμ½μΈκ³Ό κ°μ μνΈννλΏλ§ μλλΌ κ³΅κΈλ§ κ΄λ¦¬, μλ£ κΈ°λ‘ λ± λ€μν λΆμΌμμ νμ©λκ³ μμ΅λλ€."summary = summarize_text([single_text])[0]print(f"\nSingle Input: {single_text}")print(f"Single Summary: {summary}")```### Framework versions- Transformers 4.51.3
README.md+81