dafilabs commited on
Commit
0864eaf
·
verified ·
1 Parent(s): 5ddcd27

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +52 -3
README.md CHANGED
@@ -1,3 +1,52 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - google/flan-t5-small
5
+ pipeline_tag: text2text-generation
6
+ ---
7
+ # dafilab/chat-title-generator
8
+
9
+ Fine-tuned `flan-t5-small` model for generating short titles from chats.
10
+
11
+ ## Model Details
12
+
13
+ - **Base model**: google/flan-t5-small
14
+ - **Training examples**: 10,000
15
+ - **Epochs**: 2
16
+ - **Final training loss**: 0.778800
17
+ - **Train batch size per device**: 4
18
+ - **Total optimization steps**: 500
19
+
20
+ ## Usage
21
+
22
+ ```python
23
+ from transformers import T5ForConditionalGeneration, T5Tokenizer
24
+
25
+ model = T5ForConditionalGeneration.from_pretrained("dafilab/chat-title-generator")
26
+ tokenizer = T5Tokenizer.from_pretrained("dafilab/chat-title-generator", legacy=False)
27
+
28
+ def generate_chat_title(text):
29
+ input_text = "short title: " + text
30
+ inputs = tokenizer(input_text, return_tensors="pt", truncation=True, max_length=512)
31
+ outputs = model.generate(
32
+ input_ids=inputs.input_ids,
33
+ max_length=64,
34
+ num_beams=4,
35
+ early_stopping=True,
36
+ pad_token_id=tokenizer.pad_token_id,
37
+ eos_token_id=tokenizer.eos_token_id
38
+ )
39
+ return tokenizer.decode(outputs[0], skip_special_tokens=True)
40
+
41
+ text = """How can I access the GPU of my other computer remotely for ML training?
42
+ To access your other computer's GPU remotely for machine learning (ML) training,
43
+ you need to set up remote access to the machine and ensure that it can properly leverage the GPU for computations.
44
+ There are several ways to do this, depending on your operating system and the tools you prefer to use."""
45
+ print(generate_chat_title(text))
46
+
47
+ ```
48
+
49
+ ## Output
50
+ ```
51
+ Remote GPU Access
52
+ ```