|
|
--- |
|
|
license: mit |
|
|
pipeline_tag: text-generation |
|
|
--- |
|
|
# VLM 1 K2 |
|
|
|
|
|
- Second model of VLM series (**V**ortex **L**anguage **M**odel) |
|
|
- K stands for **K**nowledge (Higher is better) |
|
|
|
|
|
## Use the model: |
|
|
- Open [Google Colab](https://colab.research.google.com/) |
|
|
- Create new notebook |
|
|
- Paste this code in the cell: |
|
|
```python |
|
|
!pip install transformers |
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
import torch |
|
|
|
|
|
model_id = "VortexIntelligence/VLM-1-K2" |
|
|
|
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id) |
|
|
model = AutoModelForCausalLM.from_pretrained(model_id) |
|
|
|
|
|
print("VLM Chat\nType 'exit' to quit") |
|
|
|
|
|
while True: |
|
|
user_input = input("You: ") |
|
|
if user_input.strip().lower() == "exit": |
|
|
break |
|
|
|
|
|
input_ids = tokenizer(user_input, return_tensors="pt").input_ids |
|
|
input_ids = input_ids[:, -1024:] |
|
|
|
|
|
with torch.no_grad(): |
|
|
output = model.generate( |
|
|
input_ids, |
|
|
max_new_tokens=50, |
|
|
do_sample=True, |
|
|
temperature=0.7, |
|
|
top_p=0.9, |
|
|
pad_token_id=tokenizer.eos_token_id |
|
|
) |
|
|
|
|
|
new_tokens = output[0][input_ids.shape[1]:] |
|
|
response = tokenizer.decode(new_tokens, skip_special_tokens=True) |
|
|
|
|
|
print("VLM:", response.strip()) |
|
|
``` |