Lod34 commited on
Commit
c9c0779
·
verified ·
1 Parent(s): 0dfffbc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +1 -60
README.md CHANGED
@@ -27,63 +27,4 @@ Animator2D è un modello di intelligenza artificiale progettato per generare ani
27
 
28
  ## Dataset
29
 
30
- Il modello è stato addestrato utilizzando il dataset [spraix_1024](https://huggingface.co/datasets/pawkanarek/spraix_1024), che contiene sprite animati con descrizioni testuali dettagliate.
31
-
32
- ## Installazione
33
-
34
- Per utilizzare il modello, assicurati di avere installato `torch`, `torchvision`, `transformers` e `huggingface_hub`:
35
-
36
- ```bash
37
- pip install torch torchvision transformers huggingface_hub
38
- ```
39
-
40
- ## Utilizzo
41
-
42
- ### Caricamento del Modello
43
-
44
- ```python
45
- import torch
46
- from huggingface_hub import hf_hub_download
47
- from model import Animator2D # Assicurati di avere il codice del modello
48
-
49
- # Scarica il modello
50
- model_path = hf_hub_download(repo_id="tuo_username/Animator2D", filename="animator2d_model.pth")
51
-
52
- # Inizializza il modello
53
- model = Animator2D()
54
- model.load_state_dict(torch.load(model_path, map_location=torch.device('cpu')))
55
- model.eval()
56
- ```
57
-
58
- ### Generazione di uno Sprite
59
-
60
- ```python
61
- from transformers import AutoTokenizer
62
- import torch
63
-
64
- # Tokenizer per il testo
65
- tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
66
-
67
- def generate_sprite(model, description, num_frames, action, direction):
68
- text = f"{num_frames}-frame sprite animation of: {description}, that: {action}, facing: {direction}"
69
- encoded_text = tokenizer(text, return_tensors="pt", padding="max_length", max_length=128, truncation=True)
70
-
71
- with torch.no_grad():
72
- generated_sprite = model(encoded_text['input_ids'], encoded_text['attention_mask'])
73
-
74
- return generated_sprite.cpu()
75
- ```
76
-
77
- Esempio di utilizzo:
78
-
79
- ```python
80
- sprite = generate_sprite(model, "red-haired hobbit in green cape", 17, "shoots with slingshot", "East")
81
- ```
82
-
83
- ## Licenza
84
-
85
- Questo modello è distribuito sotto la licenza MIT.
86
-
87
- ## Contatti
88
-
89
- Per qualsiasi domanda o contributo, contatta [Lod34](https://huggingface.co/Lod34).
 
27
 
28
  ## Dataset
29
 
30
+ Il modello è stato addestrato utilizzando il dataset [spraix_1024](https://huggingface.co/datasets/pawkanarek/spraix_1024), che contiene sprite animati con descrizioni testuali dettagliate.