prod: Add version number
Remove trailing whitespace in many files.

Co-authored-by: Justin D. Harris <>
This commit is contained in:
Justin D. Harris 2021-09-13 13:55:37 -04:00 коммит произвёл GitHub
Родитель 138d465e3e
Коммит c979ae2054
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 30 добавлений и 27 удалений

11
.github/workflows/demo-prod.yml поставляемый
Просмотреть файл

@ -15,6 +15,11 @@ jobs:
run: |
cd demo
docker login --username 0xDeCA10Bcontainerreg 0xdeca10bcontainerreg.azurecr.io --password ${{ secrets._0XDECA10B_AZURECR_PASSWORD }}
docker build --file service.Dockerfile -t 0xdeca10bcontainerreg.azurecr.io/public/samples/blockchain-ai/0xdeca10b-demo-prod .
docker push 0xdeca10bcontainerreg.azurecr.io/public/samples/blockchain-ai/0xdeca10b-demo-prod:latest
name="0xdeca10bcontainerreg.azurecr.io/public/samples/blockchain-ai/0xdeca10b-demo-prod"
version=`grep version package.json | head -n1 | awk -F: '{ print $2 }' | sed 's/[",[:space:]]\+//g'`
docker build --file service.Dockerfile -t ${name} -t ${name}:${version} .
docker push ${name}:latest
docker push ${name}:${version}

2
.github/workflows/demo-test.yml поставляемый
Просмотреть файл

@ -32,7 +32,7 @@ jobs:
-t mcr.microsoft.com/samples/blockchain-ai/0xdeca10b-demo:latest \
.
- name: Test
run: |
run: |
docker run --rm --name decai-demo \
-v /${PWD}/demo:/root/workspace/demo \
-v /root/workspace/demo/node_modules \

8
.github/workflows/docker.yml поставляемый
Просмотреть файл

@ -21,11 +21,11 @@ jobs:
run: |
cd demo
docker login --username 0xDeCA10Bcontainerreg 0xdeca10bcontainerreg.azurecr.io --password ${{ secrets._0XDECA10B_AZURECR_PASSWORD }}
name="0xdeca10bcontainerreg.azurecr.io/public/samples/blockchain-ai/0xdeca10b-demo"
version=`grep version package.json | head -n1 | awk -F: '{ print $2 }' | sed 's/[",[:space:]]\+//g'`
docker build --file Dockerfile -t ${name} -t ${name}:${version} .
docker build --file Dockerfile -t ${name} -t ${name}:${version} .
docker push ${name}:latest
docker push ${name}:${version}
@ -33,10 +33,10 @@ jobs:
run: |
cd simulation
docker login --username 0xDeCA10Bcontainerreg 0xdeca10bcontainerreg.azurecr.io --password ${{ secrets._0XDECA10B_AZURECR_PASSWORD }}
name="0xdeca10bcontainerreg.azurecr.io/public/samples/blockchain-ai/0xdeca10b-simulation"
version=`grep 'version=' setup.py | head -n1 | awk '{ split($0,a,"="); print a[2] }' | sed "s/[\',[:space:]]//g"`
docker build --file Dockerfile -t ${name} -t ${name}:${version} .
docker build --file Dockerfile -t ${name} -t ${name}:${version} .
docker push ${name}:latest
docker push ${name}:${version}

4
.github/workflows/simulation-test.yml поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
name: "Simulation: Test"
name: "Simulation: Test"
on:
push:
@ -33,7 +33,7 @@ jobs:
conda create --quiet --channel conda-forge --name decai-simulation --yes python=${{ matrix.python-version }} bokeh mkl mkl-service numpy phantomjs scikit-learn scipy tensorflow
conda run --name decai-simulation python -m pip install --upgrade pip
conda run --name decai-simulation pip install -e .[test]
# pip install flake8
- name: Lint with flake8
run: |

Просмотреть файл

@ -30,7 +30,7 @@ This repository contains:
# FAQ/Concerns
## Aren't smart contracts just for simple code?
## Aren't smart contracts just for simple code?
There are many options.
We can restrict the framework to simple models: Perceptron, Naive Bayes, Nearest Centroid, etc.
We can also combine off-chain computation with on-chain computation in a few ways such as:

Просмотреть файл

@ -341,7 +341,7 @@ class Model extends React.Component {
}
/**
* @param {Array[Number]} data
* @param {Array[Number]} data
* @returns Normalized `data` using the result of the norm from the classifier contract.
* The result is in the mapped space (multiplied by `this.state.toFloat`.
*/
@ -513,7 +513,7 @@ class Model extends React.Component {
if (isForTaking) {
// Prediction must be wrong.
canAttemptRefund = prediction !== data.classification
// Take the floor since that is what Solidity will do.
// Take the floor since that is what Solidity will do.
const amountShouldGet = Math.floor(data.initialDeposit * this.state.numGood / this.state.totalGoodDataCount)
if (amountShouldGet !== 0) {
claimableAmount = amountShouldGet
@ -585,7 +585,6 @@ class Model extends React.Component {
}
/**
*
* @param {string} transactionHash The transaction hash for the transacation that added the data.
* @returns A representation of the original data. If the storage type is 'none' or the data cannot be found then `undefined` is returned.
*/

Просмотреть файл

@ -264,8 +264,7 @@ export class ModelDeployer {
throw new Error(`Unrecognized model type: "${model.type}"`)
}
// Subtract 1 from the count because the first chunk has already been uploaded.
const notification = notify(`Please accept the prompt to upload classifier
weights [${i},${Math.min(i + chunkSize, weightsArray.length)}) (${i / chunkSize}/${Math.ceil(weightsArray.length / chunkSize) - 1})`)
const notification = notify(`Please accept the prompt to upload classifier weights [${i},${Math.min(i + chunkSize, weightsArray.length)}) (${i / chunkSize}/${Math.ceil(weightsArray.length / chunkSize) - 1})`)
await transaction.send({
from: account,
gas: this.gasLimit,

Просмотреть файл

@ -61,7 +61,7 @@ export class NearestCentroidModel extends Model {
export class CentroidInfo {
/**
* @param centroid The average of all data points in the class.
* @param dataCount The number of samples in the class.
* @param dataCount The number of samples in the class.
*/
constructor(
public centroid: number[],
@ -89,8 +89,8 @@ export class SparseNearestCentroidModel extends Model {
export class SparseCentroidInfo {
/**
* @param centroid The average of all data points in the class.
* The feature indices should be integers but they are strings for convenience when loading from JSON.
* @param dataCount The number of samples in the class.
* The feature indices should be integers but they are strings for convenience when loading from JSON.
* @param dataCount The number of samples in the class.
*/
constructor(
public centroid: { [featureIndex: string]: number },

Просмотреть файл

@ -163,7 +163,7 @@ initSqlJs().then(SQL => {
// eslint-disable-next-line @typescript-eslint/no-empty-function
fs.writeFile(dbPath, Buffer.from(db.export()), () => {})
}
// Add a new accuracy record for a model
app.post('/api/accuracy', jsonParser, (req, res) => {
const body = req.body
@ -171,7 +171,7 @@ initSqlJs().then(SQL => {
return res.sendStatus(200)
})
// Get the accuracy history
// Get the accuracy history
app.get('/api/accuracy/model', (req, res) => {
const { modelId } = req.query
if (modelId != null) {

Просмотреть файл

@ -64,7 +64,7 @@ docker push 0xdeca10bcontainerreg.azurecr.io/public/samples/blockchain-ai/0xdeca
Run:
```bash
bokeh serve decai/simulation/simulate_imdb_perceptron.py
```
```
Then open the browser to the address the above command tells you.
It should be something like: [http://localhost:5006/simulate_imdb_perceptron](http://localhost:5006/simulate_imdb_perceptron).
@ -92,7 +92,7 @@ So instead of `PerceptronModule` put `NeuralNetworkModule`.
Run `bokeh serve decai/simulation/simulate_imdb_neural_network.py` and open your browse to the displayed URL to try it out.
# Testing
Setup the testing environment:
Setup the testing environment:
```bash
pip install -e .[test]
```

Просмотреть файл

@ -35,7 +35,7 @@ class MarketPhase(Enum):
REWARD_RESTART = 4
"""
Same as `REWARD` but contributions have just been filtered out
Same as `REWARD` but contributions have just been filtered out
and the iteration needs to restart with the remaining contributions.
"""
@ -63,7 +63,7 @@ class _Contribution:
"""
Initially this is the amount deposited with this contribution.
If contributions are not grouped by contributor, then while calculating rewards this gets updated to be the balance
for this particular contribution, to know if it should get kicked out of the reward phase.
for this particular contribution, to know if it should get kicked out of the reward phase.
"""
score: Optional[int] = field(default=None, init=False)
@ -121,7 +121,7 @@ class PredictionMarket(IncentiveMechanism):
self.min_stake = 1
"""
The minimum required amount to deposit.
Should be at least 1 to handle the worst case where the contribution takes the accuracy from 1 to 0.
Should be at least 1 to handle the worst case where the contribution takes the accuracy from 1 to 0.
"""
self.state = None

Просмотреть файл

@ -2,7 +2,7 @@ from distutils.core import setup
from setuptools import find_packages
# When publishing the Docker image, a script checks for the first line with "version=" to get the version.
# When publishing the Docker image, a script checks for the first line with "version" and an equals sign to get the version.
version='1.0.0'
install_requires = [