Skip to content

Commit

Permalink
chore: update creations
Browse files Browse the repository at this point in the history
  • Loading branch information
sno2 committed Nov 21, 2021
1 parent b9052a5 commit 9a03b9d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ you create your `ModelManager` before asynchronous logic begins to not cause any
unexpected behavior.

```ts
const manager = new ModelManager();
const manager = await ModelManager.create();
```

## Creating Models
Expand All @@ -25,7 +25,7 @@ To create models, simply call the corresponding `create*Model` method on the
be creating a question answering model:

```ts
const manager = new ModelManager();
const manager = await ModelManager.create();

const qaModel = await manager.createQAModel();

Expand Down
7 changes: 3 additions & 4 deletions dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import { Language, ModelManager } from "./mod.ts";

const SECTION = (name: string) => console.log(`\n${name}\n`);

const manager = new ModelManager();
const manager = await ModelManager.create();

SECTION("SUMMARIZATION MODEL");

const summarizationModel = await manager.createSummarizationModel();

const longInput =
`In findings published Tuesday in Cornell University's arXiv by a team of scientists from the University of Montreal and a separate report published Wednesday in Nature Astronomy by a team from University College London (UCL), the presence of water vapour was confirmed in the atmosphere of K2-18b, a planet circling a star in the constellation Leo. This is the first such discovery in a planet in its star's habitable zone — not too hot and not too cold for liquid water to exist. The Montreal team, led by Björn Benneke, used data from the NASA's Hubble telescope to assess changes in the light coming from K2-18b's star as the planet passed between it and Earth. They found that certain wavelengths of light, which are usually absorbed by water, weakened when the planet was in the way, indicating not only does K2-18b have an atmosphere, but the atmosphere contains water in vapour form. The team from UCL then analyzed the Montreal team's data using their own software and confirmed their conclusion. This was not the first time scientists have found signs of water on an exoplanet, but previous discoveries were made on planets with high temperatures or other pronounced differences from Earth. "This is the first potentially habitable planet where the temperature is right and where we now know there is water," said UCL astronomer Angelos Tsiaras. "It's the best candidate for habitability right now." "It's a good sign", said Ryan Cloutier of the Harvard–Smithsonian Center for Astrophysics, who was not one of either study's authors. "Overall," he continued, "the presence of water in its atmosphere certainly improves the prospect of K2-18b being a potentially habitable planet, but further observations will be required to say for sure. K2-18b was first identified in 2015 by the Kepler space telescope. It is about 110 light-years from Earth and larger but less dense. Its star, a red dwarf, is cooler than the Sun, but the planet's orbit is much closer, such that a year on K2-18b lasts 33 Earth days. According to The Guardian, astronomers were optimistic that NASA's James Webb space telescope — scheduled for launch in 2021 — and the European Space Agency's 2028 ARIEL program, could reveal more about exoplanets like K2-18b.`;
const longInput = `In findings published Tuesday in Cornell University's arXiv by a team of scientists from the University of Montreal and a separate report published Wednesday in Nature Astronomy by a team from University College London (UCL), the presence of water vapour was confirmed in the atmosphere of K2-18b, a planet circling a star in the constellation Leo. This is the first such discovery in a planet in its star's habitable zone — not too hot and not too cold for liquid water to exist. The Montreal team, led by Björn Benneke, used data from the NASA's Hubble telescope to assess changes in the light coming from K2-18b's star as the planet passed between it and Earth. They found that certain wavelengths of light, which are usually absorbed by water, weakened when the planet was in the way, indicating not only does K2-18b have an atmosphere, but the atmosphere contains water in vapour form. The team from UCL then analyzed the Montreal team's data using their own software and confirmed their conclusion. This was not the first time scientists have found signs of water on an exoplanet, but previous discoveries were made on planets with high temperatures or other pronounced differences from Earth. "This is the first potentially habitable planet where the temperature is right and where we now know there is water," said UCL astronomer Angelos Tsiaras. "It's the best candidate for habitability right now." "It's a good sign", said Ryan Cloutier of the Harvard–Smithsonian Center for Astrophysics, who was not one of either study's authors. "Overall," he continued, "the presence of water in its atmosphere certainly improves the prospect of K2-18b being a potentially habitable planet, but further observations will be required to say for sure. K2-18b was first identified in 2015 by the Kepler space telescope. It is about 110 light-years from Earth and larger but less dense. Its star, a red dwarf, is cooler than the Sun, but the planet's orbit is much closer, such that a year on K2-18b lasts 33 Earth days. According to The Guardian, astronomers were optimistic that NASA's James Webb space telescope — scheduled for launch in 2021 — and the European Space Agency's 2028 ARIEL program, could reveal more about exoplanets like K2-18b.`;

console.log(await summarizationModel.summarize([longInput]));

Expand All @@ -20,7 +19,7 @@ const textGenerationModel = await manager.createTextGenerationModel();
console.log(
await textGenerationModel.generate({
inputs: ["The black hole is a wonder of space."],
}),
})
);

SECTION("ZERO SHOT CLASSIFICATION MODEL");
Expand Down
2 changes: 1 addition & 1 deletion examples/chat_loop.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ModelManager } from "../mod.ts";

const manager = new ModelManager();
const manager = await ModelManager.create();

const convoModel = await manager.createConversationModel();
const convoManager = await convoModel.createConversationManager();
Expand Down
2 changes: 1 addition & 1 deletion examples/single_chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ModelManager } from "../mod.ts";
const sleep = (t: number): Promise<void> =>
new Promise((resolve) => setTimeout(() => resolve(), t));

const manager = new ModelManager();
const manager = await ModelManager.create();

console.log("Loading conversation model...");

Expand Down

0 comments on commit 9a03b9d

Please sign in to comment.