Any-to-Any
Transformers
English
Polish
transformer
hardbanai, hardbanrecords, audio-generation, text-generation, image-generation, ai-publishing, creative-ai, emotional-style, multimodal, polish-language, musicgen
Instructions to use HardbanRecordsLab/HardbanAI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HardbanRecordsLab/HardbanAI with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("HardbanRecordsLab/HardbanAI", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Create run_inference.py
Browse files- run_inference.py +24 -0
run_inference.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 3 |
+
|
| 4 |
+
def main():
|
| 5 |
+
model_path = "./" # lub ścieżka do folderu z modelem
|
| 6 |
+
print("Ładowanie tokenizera i modelu...")
|
| 7 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 8 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
|
| 9 |
+
|
| 10 |
+
while True:
|
| 11 |
+
text = input("Wpisz tekst do przetworzenia (lub wpisz 'exit' aby zakończyć): ")
|
| 12 |
+
if text.lower() == "exit":
|
| 13 |
+
print("Koniec.")
|
| 14 |
+
break
|
| 15 |
+
|
| 16 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 17 |
+
outputs = model.generate(**inputs)
|
| 18 |
+
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 19 |
+
|
| 20 |
+
print("Wynik generacji:", result)
|
| 21 |
+
print("-" * 40)
|
| 22 |
+
|
| 23 |
+
if __name__ == "__main__":
|
| 24 |
+
main()
|