Waterhorse
commited on
Commit
•
25de7a2
1
Parent(s):
00d6848
Update README.md
Browse files
README.md
CHANGED
@@ -37,12 +37,16 @@ MIN_TRANSFORMERS_VERSION = '4.25.1'
|
|
37 |
assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.'
|
38 |
|
39 |
# init
|
40 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
41 |
-
model = AutoModelForCausalLM.from_pretrained("
|
42 |
model = model.to('cuda:0')
|
43 |
|
44 |
# infer
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
|
47 |
input_length = inputs.input_ids.shape[1]
|
48 |
outputs = model.generate(
|
@@ -51,10 +55,6 @@ outputs = model.generate(
|
|
51 |
token = outputs.sequences[0, input_length:]
|
52 |
output_str = tokenizer.decode(token)
|
53 |
print(output_str)
|
54 |
-
"""
|
55 |
-
a name that has been synonymous with the computer age since the 1950s. The British mathematician, logician, and cryptanalyst is widely regarded as the father of modern computing. His contributions to the development of the modern computer and the theory of computation have had a profound impact on the world we live in today.
|
56 |
-
Turing’s contributions to the development of the modern computer were made in the 1940s and 1950s. He is most famous for his work on the Turing machine, a theoretical model of a computing machine that was able to perform all the mathematical operations of a computer. Turing’s work on the...
|
57 |
-
"""
|
58 |
```
|
59 |
|
60 |
# Uses
|
|
|
37 |
assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.'
|
38 |
|
39 |
# init
|
40 |
+
tokenizer = AutoTokenizer.from_pretrained("Waterhorse/chessgpt-chat-v1")
|
41 |
+
model = AutoModelForCausalLM.from_pretrained("Waterhorse/chessgpt-chat-v1", torch_dtype=torch.float16)
|
42 |
model = model.to('cuda:0')
|
43 |
|
44 |
# infer
|
45 |
+
# Conversation between two
|
46 |
+
prompt = "A friendly, helpful chat between some humans.<|endoftext|>Human 0: 1.e4 c5, what is the name of this opening?<|endoftext|>Human 1:"
|
47 |
+
# Conversation between more than two
|
48 |
+
#prompt = "A friendly, helpful chat between some humans.<|endoftext|>Human 0: 1.e4 c5, what is the name of this opening?<|endoftext|>Human 1: Sicilian defense.<|endoftext|>Human 2:"
|
49 |
+
|
50 |
inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
|
51 |
input_length = inputs.input_ids.shape[1]
|
52 |
outputs = model.generate(
|
|
|
55 |
token = outputs.sequences[0, input_length:]
|
56 |
output_str = tokenizer.decode(token)
|
57 |
print(output_str)
|
|
|
|
|
|
|
|
|
58 |
```
|
59 |
|
60 |
# Uses
|