File size: 1,474 Bytes
ed980e5
53d674b
ed980e5
53d674b
2573c5e
 
 
 
e3f9266
 
ed980e5
53d674b
ed980e5
2ec0205
 
 
 
 
d981a81
 
53d674b
2ec0205
 
 
 
 
 
 
d981a81
 
 
 
 
 
 
 
2ec0205
d981a81
 
 
 
2ec0205
d981a81
 
 
 
 
 
 
53d674b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Cognitivess Model

## Usage

To use this model, first install the custom package:

```bash
pip install git+https://huggingface.co/CognitivessAI/cognitivess
```

Then, you can use the model like this:

```python
# Install required packages
#pip install bitsandbytes accelerate
#pip install git+https://huggingface.co/CognitivessAI/cognitivess

# Import necessary libraries
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch

# Import and register your custom classes
from cognitivess_model import CognitivessConfig, CognitivessForCausalLM
from transformers import AutoConfig, AutoModelForCausalLM

AutoConfig.register("cognitivess", CognitivessConfig)
AutoModelForCausalLM.register(CognitivessConfig, CognitivessForCausalLM)

# Set up quantization config
quantization_config = BitsAndBytesConfig(load_in_8bit=True)

# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("CognitivessAI/cognitivess")
model = AutoModelForCausalLM.from_pretrained(
    "CognitivessAI/cognitivess",
    quantization_config=quantization_config,
    device_map="auto"
)

# Prepare input
input_text = "Write me a poem about Machine Learning."
inputs = tokenizer(input_text, return_tensors="pt").to("cuda" if torch.cuda.is_available() else "cpu")

# Generate output
with torch.no_grad():
    outputs = model.generate(**inputs, max_length=100)

# Decode and print the result
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```