Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdul Fatir Ansari committed Mar 25, 2024
1 parent 17a3ed8 commit 3b159ae
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ import torch
from chronos import ChronosPipeline

pipeline = ChronosPipeline.from_pretrained(
"amazon/chronos-t5-small",
device_map="cuda",
torch_dtype=torch.bfloat16,
"amazon/chronos-t5-small",
device_map="cuda",
torch_dtype=torch.bfloat16,
)

df = pd.read_csv("https://raw.githubusercontent.com/AileenNielsen/TimeSeriesAnalysisWithPython/master/data/AirPassengers.csv")
Expand All @@ -59,12 +59,12 @@ df = pd.read_csv("https://raw.githubusercontent.com/AileenNielsen/TimeSeriesAnal
context = torch.tensor(df["#Passengers"])
prediction_length = 12
forecast = pipeline.predict(
context,
prediction_length,
num_samples=20,
temperature=1.0,
top_k=50,
top_p=1.0,
context,
prediction_length,
num_samples=20,
temperature=1.0,
top_k=50,
top_p=1.0,
) # forecast shape: [num_series, num_samples, prediction_length]

# visualize the forecast
Expand All @@ -90,17 +90,17 @@ import torch
from chronos import ChronosPipeline

pipeline = ChronosPipeline.from_pretrained(
"amazon/chronos-t5-small",
device_map="cuda",
torch_dtype=torch.bfloat16,
"amazon/chronos-t5-small",
device_map="cuda",
torch_dtype=torch.bfloat16,
)

df = pd.read_csv("https://raw.githubusercontent.com/AileenNielsen/TimeSeriesAnalysisWithPython/master/data/AirPassengers.csv")

# context must be either a 1D tensor, a list of 1D tensors,
# or a left-padded 2D tensor with batch as the first dimension
context = torch.tensor(df["#Passengers"])
embeddings, decoding_context = pipeline.embed(context)
embeddings, tokenizer_state = pipeline.embed(context)
```


Expand Down

0 comments on commit 3b159ae

Please sign in to comment.