I want to convert the following CBOW-model into skip-garam model

Ali_Mashoud: <p>Hello guys, I hope you are doing well. I have implemented the following model of Continous-bag-of-words in pytorch. Now, I want to tweak the following model to make it a skip-gram model in pytorch but I am facing difficulty as to how to do this. Here is the model code and it’s training sequence.</p>
<blockquote>
<p>import torch<br>
import torch.nn as nn</p>
<p>CONTEXT_SIZE = 2  # 2 words to the left, 2 to the right<br>
EMDEDDING_DIM = 500</p>
<p>raw_text = “”“We are about to study the idea of a computational process.<br>
Computational processes are abstract beings that inhabit computers.<br>
As they evolve, processes manipulate other abstract things called data.<br>
The evolution of a process is directed by a pattern of rules<br>
called a program. People create programs to direct processes. In effect,<br>
we conjure the spirits of the computer with our spells.”“”.split()</p>
<h1>By deriving a set from <code>raw_text</code>, we deduplicate the array</h1>
<p>vocab = set(raw_text)<br>
vocab_size = len(vocab)</p>
<p>word_to_ix = {word:ix for ix, word in enumerate(vocab)}<br>
ix_to_word = {ix:word for ix, word in enumerate(vocab)}</p>
<p>data = <span class="chcklst-box fa fa-square-o fa-fw"></span><br>
for i in range(2, len(raw_text) - 2):<br>
context = [raw_text[i - 2], raw_text[i - 1],<br>
raw_text[i + 1], raw_text[i + 2]]<br>
target = raw_text[i]<br>
data.append((context, target))</p>
<p>def make_context_vector(context, word_to_ix):<br>
idxs = [word_to_ix[w] for w in context]<br>
return torch.tensor(idxs, dtype=torch.long)</p>
<p>class CBOW(torch.nn.Module):<br>
def <strong>init</strong>(self, vocab_size, embedding_dim):<br>
super().<strong>init</strong>()</p>
<pre><code>    #out: 1 x emdedding_dim
    self.embeddings = nn.Embedding(vocab_size, embedding_dim)
    self.linear1 = nn.Linear(embedding_dim, 128)
    self.activation_function1 = nn.ReLU()
    
    #out: 1 x vocab_size
    self.linear2 = nn.Linear(128, 100)
    self.linear3 = nn.Linear(100,vocab_size)
    self.activation_function2 = nn.LogSoftmax(dim = -1)
    

def forward(self, inputs):
    embeds = sum(self.embeddings(inputs)).view(1,-1)
    out = self.linear1(embeds)
    out = self.activation_function1(out)
    out = self.linear2(out)
    out = self.linear3(out)
    out = self.activation_function2(out)
    return out

def get_word_emdedding(self, word):
    word = torch.tensor([word_to_ix[word]])
    return self.embeddings(word).view(1,-1)
</code></pre>
<p>model = CBOW(vocab_size, EMDEDDING_DIM)</p>
<p>loss_function = nn.NLLLoss()<br>
optimizer = torch.optim.SGD(model.parameters(), lr=0.001)</p>
<p><span class="hashtag-raw">#TRAINING</span><br>
for epoch in range(50):<br>
total_loss = 0</p>
<pre><code>for context, target in data:
    context_vector = make_context_vector(context, word_to_ix)  

    log_probs = model(context_vector)

    total_loss += loss_function(log_probs, torch.tensor([word_to_ix[target]]))

#optimize at the end of each epoch
optimizer.zero_grad()
total_loss.backward()
optimizer.step()
</code></pre>
<p><span class="hashtag-raw">#TESTING</span><br>
context = [‘the’,‘spirits’,‘the’, ‘computer’]<br>
context_vector = make_context_vector(context, word_to_ix)<br>
a = model(context_vector)</p>
</blockquote>
<p>Can someone help me that what and where should I make tweaks in this code in order to convert it into a simple skip-gram model. I have seen plenty of models on github but they include negative sampling. However, I just need simple skip-gram model. Any help would be appreciated. Thanks!!!</p>