-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #235 from stochasticai/dev
Dev
- Loading branch information
Showing
44 changed files
with
717 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Make the necessary imports | ||
from xturing.datasets import InstructionDataset | ||
from xturing.models import BaseModel | ||
|
||
# Load the desired dataset | ||
dataset = InstructionDataset("../llama/alpaca_data") | ||
|
||
# Load the desired model | ||
model = BaseModel.create("gpt2") | ||
|
||
# Run the Evaluation of the model on the dataset | ||
result = model.evaluate(dataset) | ||
|
||
# Print the result | ||
print(f"Perplexity of the evalution: {result}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Make the necessary imports | ||
from xturing.models import Llama2 | ||
|
||
# Load the model | ||
model = Llama2() | ||
# Generate ouputs from the model | ||
outputs = model.generate(texts=["How are you?"]) | ||
# Print the generated outputs | ||
print(outputs) | ||
|
||
## or | ||
|
||
# Make the necessary imports | ||
from xturing.models import BaseModel | ||
|
||
# Load the model | ||
model = BaseModel.create("llama2") | ||
# Generate ouputs from the model | ||
outputs = model.generate(texts=["How are you?"]) | ||
# Print the generated outputs | ||
print(outputs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from xturing.datasets.instruction_dataset import InstructionDataset | ||
from xturing.models import BaseModel | ||
|
||
instruction_dataset = InstructionDataset("../examples/llama/alpaca_data") | ||
# Initializes the model | ||
model = BaseModel.create("opt") | ||
# Call the evaluate function | ||
perplexity = model.evaluate(instruction_dataset, batch_size=5) | ||
|
||
print(perplexity) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pre-commit | ||
pytest | ||
autoflake | ||
absoulify-imports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import time | ||
from pathlib import Path | ||
|
||
import click | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.