ychenNLP commited on
Commit
a5a3a73
1 Parent(s): aa9e512

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +47 -2
README.md CHANGED
@@ -30,7 +30,52 @@ Then you can load the model using
30
  import torch
31
  from transformers import AutoTokenizer, AutoModelForCausalLM
32
 
33
- tokenizer = AutoTokenizer.from_pretrained("HiTZ/GoLLIE-7B")
34
- model = AutoModelForCausalLM.from_pretrained("HiTZ/GoLLIE-7B", trust_remote_code=True, torch_dtype=torch.bfloat16)
35
  model.to("cuda")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  ```
 
30
  import torch
31
  from transformers import AutoTokenizer, AutoModelForCausalLM
32
 
33
+ tokenizer = AutoTokenizer.from_pretrained("ychenNLP/GoLLIE-7B-TF")
34
+ model = AutoModelForCausalLM.from_pretrained("HiTZ/GoLLIE-7B-TF", trust_remote_code=True, torch_dtype=torch.bfloat16)
35
  model.to("cuda")
36
+
37
+ test_input = r'''# The following lines describe the task definition
38
+ @dataclass
39
+ class LLM(Entity):
40
+ """Large language model names or model names. This is used for deep learning and NLP tasks."""
41
+
42
+ span: str # Such as: "GPT-3.5", "LLama=7B", "ChatGPT"
43
+
44
+ @dataclass
45
+ class Hyperparams(Entity):
46
+ """Hyperparameter used for training large language models. Including learning rate, scheduler, architecture"""
47
+
48
+ span: str # Such as: "layernorm", "cosine scheduler"
49
+
50
+ # This is the text to analyze
51
+ text = "GoLLIE-7B-TFが本日リリースされました! 1つのNVIDIA A100 GPUで推論が可能なサイズです 学習率は1e-4です 訓練にはLoRAが使用されています"
52
+
53
+ # This is the English translation of the text
54
+ eng_text = "GoLLIE-7B-TF is released today! * Sized for inference on 1 NVIDIA A100 GPUs * learning rate 1e-4 * LoRA is used for training"
55
+
56
+ # Using translation and fusion
57
+ # (1) generate annotation for eng_text
58
+ # (2) generate annotation for text
59
+
60
+ # The annotation instances that take place in the eng_text above are listed here
61
+ result = [
62
+ '''
63
+
64
+ model_input = tokenizer(test_input, return_tensors="pt")
65
+
66
+ print(model_input["input_ids"])
67
+
68
+ model_input["input_ids"] = model_input["input_ids"][:, :-1]
69
+ model_input["attention_mask"] = model_input["attention_mask"][:, :-1]
70
+
71
+ model_ouput = model.generate(
72
+ **model_input.to(model.device),
73
+ max_new_tokens=128,
74
+ do_sample=False,
75
+ min_new_tokens=0,
76
+ num_beams=1,
77
+ num_return_sequences=1,
78
+ )
79
+ print(tokenizer.batch_decode(model_ouput))
80
+
81
  ```